0xMiden / 0xMiden/protocol

Investigate optimizing adding and removing assets to account vault

未关闭
#1,715 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
kernels
主要语言
Rust
星标
132
派生
167
平均合并
1 天 23 小时
30 天内合并 PR
110

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。