Investigate optimizing adding and removing assets to account vault
- Lenguaje dominante
- Rust
- Estrellas
- 132
- Forks
- 167
- Merge medio
- 1 d 23 h
- PR fusionados (30 d)
- 110
Descripción
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
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.