Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shed): gas-sim compact-sectors #12837

Draft
wants to merge 1 commit into
base: rvagg/historical-beacon-client
Choose a base branch
from

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented Jan 21, 2025

Not quite as useful as it should be, I think one problem I'm facing here is the restrictions on running CompactPartitions, so even though we attempt to do 48, ~1/2 of them are locked at any particular period. So it'll only make a difference for sectors that get allocated in the partitions we are compacting.

Also, I think a lot of the messages I try out are on already compact miners, so it's best to try with older miners who are still around and are still submitting messages.

But this is serving as a framework for further experimentation, so I'm parking it here.

lotus-shed gas-sim compact-sectors bafy2bzacebuimgnswbjtb4jf5ub3lzhrfl4i2phleagr5plxewmilvjsk4qwa is one interesting message, results in:

Difference in gas charges for miner msg (without subcalls):
┌─────────────────┬───────┬─────────────┬────────┬─────────────┬────────┬───────────┬────────┐
│ Type            │ Count │ Storage Gas │     S% │ Compute Gas │     C% │ Total Gas │     T% │ 
├─────────────────┼───────┼─────────────┼────────┼─────────────┼────────┼───────────┼────────┤
│ OnBlockCreate   │    -2 │        3016 │   0.10 │        3715 │   0.16 │      6730 │   0.13 │ 
│ OnBlockLink     │    -2 │     1235820 │  42.12 │        7745 │   0.33 │   1243565 │  23.70 │ 
│ OnBlockOpen     │     9 │        7980 │   0.27 │        5400 │   0.23 │     13380 │   0.26 │ 
│ OnBlockOpenBase │     9 │     1686960 │  57.50 │        2700 │   0.12 │   1689660 │  32.20 │ 
│ OnBlockRead     │     9 │           0 │   0.00 │         543 │   0.02 │       543 │   0.01 │ 
│ OnScanIpldLinks │     7 │           0 │   0.00 │       13850 │   0.60 │     13850 │   0.26 │ 
│ OnSyscall       │    14 │           0 │   0.00 │      196000 │   8.47 │    196000 │   3.74 │ 
│ wasm_exec       │    14 │           0 │   0.00 │     2083242 │  90.06 │   2083242 │  39.70 │ 
│ Total           │    58 │     2933776 │ 100.00 │     2313195 │ 100.00 │   5246970 │ 100.00 │ 
└─────────────────┴───────┴─────────────┴────────┴─────────────┴────────┴───────────┴────────┘

CompactPartitions prior to message resulted in:
 • 58 fewer total gas charges
 • 2313195 less compute gas (9.55%)
 • 2933776 less storage gas (3.92%)
 • 5246970 less total gas (5.29%)
 • 9 fewer reads and 2 more writes

* simulate a CompactSectors prior to a miner message
* improve gas table printing and handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📌 Triage
Development

Successfully merging this pull request may close these issues.

1 participant