0xMiden / 0xMiden/protocol

Investigate optimizing adding and removing assets to account vault

Offen
#1,715 0 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
kernels
Vorherrschende Sprache
Rust
Sterne
132
Forks
167
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
110

Beschreibung

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

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.