Skip to content

Add comprehensive benchmarks for storage access#7583

Merged
ironcev merged 3 commits intomasterfrom
ironcev/dynamic-storage-add-storage-benchmarks
Apr 2, 2026
Merged

Add comprehensive benchmarks for storage access#7583
ironcev merged 3 commits intomasterfrom
ironcev/dynamic-storage-add-storage-benchmarks

Conversation

@ironcev
Copy link
Copy Markdown
Member

@ironcev ironcev commented Mar 27, 2026

Description

This PR adds comprehensive benchmarks for storage fields access. We want to have the benchmark and historical values collected, in order to be able to compare them with the storage access costs after #7560 is implemented.

The README.md explains the benchmarks and how to use the benchmarking infrastructure.

The RESULTS.md contains the benchmarking results for the current storage implementation.

The storage opcode costs are based on values in the gas_costs_values.json and are taken from the chain-configuration repository's Ignition consensus parameter 6.

The benchmarks for StorageVec operations will be added in a follow up PR.

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@cursor
Copy link
Copy Markdown

cursor Bot commented Mar 27, 2026

PR Summary

Low Risk
Low risk because changes are isolated to new test/benchmark artifacts and a helper script, with no production runtime logic changes. Main risk is increased CI time/noise from additional unit-test-style benchmark packages.

Overview
Adds a new storage_benchmarks suite under e2e VM tests to track gas-cost benchmarks for storage access.

Introduces two benchmark contracts: storage_fields (full-field read/write/clear across primitives and multiple struct sizes) and storage_fields_partial_access (read/write on nested sub-fields to measure partial access), plus a shared stored_types library of representative struct layouts.

Includes a bench.sh runner that executes each project via forc test, subtracts a per-project baseline call cost, and prints results as CSV and a scaled console histogram; README.md documents usage and RESULTS.md seeds historical baseline numbers.

Written by Cursor Bugbot for commit 97f3a23. This will update automatically on new commits. Configure here.

@ironcev ironcev self-assigned this Mar 27, 2026
@ironcev ironcev added testing General testing performance Everything related to performance, speed wise or memory wise. labels Mar 27, 2026
@ironcev
Copy link
Copy Markdown
Member Author

ironcev commented Mar 27, 2026

👍

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Wrong package name in stored_types Forc.lock
    • Updated stored_types/Forc.lock to correctly declare only the stored_types member package with no std dependency, matching its Forc.toml configuration.

Create PR

Or push these changes by commenting:

@cursor push 60890ab004
Preview (60890ab004)
diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/storage_benchmarks/stored_types/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/storage_benchmarks/stored_types/Forc.lock
--- a/test/src/e2e_vm_tests/test_programs/should_pass/storage_benchmarks/stored_types/Forc.lock
+++ b/test/src/e2e_vm_tests/test_programs/should_pass/storage_benchmarks/stored_types/Forc.lock
@@ -1,8 +1,3 @@
 [[package]]
-name = "std"
-source = "path+from-root-90F1067CD9AC8A94"
-
-[[package]]
-name = "storage_slot_key_calculation"
+name = "stored_types"
 source = "member"
-dependencies = ["std"]

This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.

@ironcev ironcev marked this pull request as ready for review March 27, 2026 19:28
@ironcev ironcev requested a review from a team as a code owner March 27, 2026 19:28
@ironcev ironcev enabled auto-merge (squash) March 27, 2026 19:45
@ironcev ironcev merged commit cd2aa35 into master Apr 2, 2026
42 checks passed
@ironcev ironcev deleted the ironcev/dynamic-storage-add-storage-benchmarks branch April 2, 2026 00:48
ironcev added a commit that referenced this pull request Apr 9, 2026
## Description

This PR is a continuation of #7583. It adds additional benchmarks for
benchmarking all `StorageVec` API methods for different element sizes
and different number of elements stored.

The `README.md` explains the benchmarks and how to use the benchmarking
infrastructure.

The `RESULTS.md` contains the benchmarking results for the current
`storage` implementation.

## Checklist

- [x] I have linked to any relevant issues.
- [x] I have commented my code, particularly in hard-to-understand
areas.
- [ ] I have updated the documentation where relevant (API docs, the
reference, and the Sway book).
- [ ] If my change requires substantial documentation changes, I have
[requested support from the DevRel
team](https://github.com/FuelLabs/devrel-requests/issues/new/choose)
- [ ] I have added tests that prove my fix is effective or that my
feature works.
- [ ] I have added (or requested a maintainer to add) the necessary
`Breaking*` or `New Feature` labels where relevant.
- [x] I have done my best to ensure that my PR adheres to [the Fuel Labs
Code Review
Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md).
- [x] I have requested a review from the relevant team or maintainers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Everything related to performance, speed wise or memory wise. testing General testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants