0xMiden / 0xMiden/protocol

Investigate optimizing adding and removing assets to account vault

Aberta
#1,715 0 comentários 3 reações 0 responsáveis Ver no GitHub
kernels
Linguagem predominante
Rust
Estrelas
132
Forks
167
Merge médio
1d 23h
PRs com merge (30d)
110

Descrição

Removing (and presumably adding) an asset with `account::remove_asset_from_vault` currently takes about 1000 cycles in the VM. The main driver is `account_delta::remove_asset` which takes 753 cycles. Within that, the main driver are `link_map` operations. `account_delta::remove_fungible_asset` takes 562 cycles in total for the simple benchmark. Of those cycles these are the contributions:
- `link_map::get` -> 249 cycles
- `link_map::set` -> 302 cycles

Within the `set` procedure, `insert_after_entry` is most expensive with 235 cycles while the others take something like ~50 cycles. We could look into whether offloading more work to the host can make this more efficient by reducing the number of checks the procedure needs to do, but more investigation is needed to find the main driver of the cycle count.

Context: https://github.com/0xMiden/miden-base/pull/1705#discussion_r2260794263

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.