Skip to content

DEBUGGING; DO NOT MERGE#6070

Draft
afck wants to merge 7 commits intolinera-io:mainfrom
afck:store-safety-dbg
Draft

DEBUGGING; DO NOT MERGE#6070
afck wants to merge 7 commits intolinera-io:mainfrom
afck:store-safety-dbg

Conversation

@afck
Copy link
Copy Markdown
Contributor

@afck afck commented Apr 20, 2026

Motivation

Proposal

Test Plan

Release Plan

  • Nothing to do / These changes follow the usual release cycle.
  • These changes should be backported to the latest devnet branch, then
    • be released in a new SDK,
    • be released in a validator hotfix.
  • These changes should be backported to the latest testnet branch, then
    • be released in a new SDK,
    • be released in a validator hotfix.
  • Backporting is not possible but we may want to deploy a new devnet and release a new
    SDK soon.

Links

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 20, 2026

Instruction Count Benchmark Results

Baseline: a81569dfe7

Deterministic metrics — reproducible across runs (34 benchmarks)
Benchmark Instructions Total R+W
Cold Load
load_1000 693,857 (No change) 1,010,338 (No change)
CollectionView
indices_100 192,360 (+0.12%) 267,627 (+0.12%)
load_all_100_from_storage 636,530 (+0.00%) 898,703 (+0.00%)
load_all_100_in_memory 340,885 (+0.01%) 477,162 (+0.01%)
pre_save_100 265,901 (No change) 367,697 (No change)
try_load_10_from_100 100,549 (No change) 142,375 (No change)
MapView
contains_key_10_from_100 52,533 (+0.04%) 74,551 (+0.03%)
contains_key_10_from_1000 355,093 (+0.01%) 501,852 (+0.01%)
get_10_from_100 55,031 (+0.04%) 78,197 (+0.03%)
get_10_from_1000 357,626 (+0.01%) 505,553 (+0.01%)
get_100_missing_from_1000 610,084 (No change) 851,233 (No change)
indices_100 100,461 (No change) 138,344 (No change)
indices_1000 948,231 (+0.00%) 1,322,215 (+0.00%)
insert_100 257,264 (No change) 355,714 (No change)
insert_1000 2,963,484 (No change) 4,013,264 (No change)
post_save_1000 1,027,028 (No change) 1,481,044 (No change)
pre_save_100 332,564 (-0.01%) 462,461 (-0.01%)
pre_save_1000 3,381,713 (No change) 4,758,733 (No change)
remove_500_from_1000 1,189,593 (-0.00%) 1,660,493 (-0.00%)
QueueView / BucketQueueView
delete_500_from_1000 22,241 (-0.74%) 34,146 (-0.65%)
front_100_from_1000 5,701 (+0.37%) 8,420 (+0.31%)
pre_save_1000 43,101 (No change) 60,470 (No change)
push_1000 24,367 (No change) 33,322 (No change)
delete_500_from_1000 10,222 (-0.21%) 12,325 (-0.21%)
front_100_from_1000 9,137 (No change) 13,881 (No change)
pre_save_1000 1,042,902 (+0.00%) 1,498,608 (+0.00%)
push_1000 24,273 (-0.09%) 33,199 (-0.08%)
ReentrantCollectionView
contains_key_10_from_100 141,897 (No change) 201,820 (No change)
indices_100 237,116 (No change) 332,341 (No change)
load_all_100_from_storage 801,698 (+0.00%) 1,129,957 (+0.00%)
load_all_100_in_memory 411,235 (+0.01%) 566,271 (+0.00%)
pre_save_100 350,812 (No change) 488,465 (No change)
RegisterView
get_set_100 81,271 (-0.03%) 120,100 (-0.02%)
pre_save 5,485 (+0.38%) 8,089 (+0.32%)

Regression threshold: 1%${\color{red}\textbf{red}}$ = regression, ${\color{green}\textbf{green}}$ = improvement.

Cache-dependent metrics — expect fluctuations between runs (34 benchmarks)
Benchmark L1 Hits LLC Hits RAM Hits Est. Cycles
Cold Load
load_1000 1,001,812 (+0.00%) 8,352 (-0.02%) 174 (No change) 1,049,662 (-0.00%)
CollectionView
indices_100 266,377 (+0.12%) 861 (No change) 389 (${\color{red}\textbf{+1.83\%%}}$) 284,297 (+0.20%)
load_all_100_from_storage 894,132 (+0.00%) 3,903 (+0.10%) 668 (+0.15%) 937,027 (+0.01%)
load_all_100_in_memory 475,025 (+0.01%) 1,400 (No change) 737 (+0.14%) 507,820 (+0.01%)
pre_save_100 365,755 (-0.00%) 1,344 (+0.07%) 598 (No change) 393,405 (+0.00%)
try_load_10_from_100 141,519 (+0.00%) 637 (-0.62%) 219 (No change) 152,369 (-0.01%)
MapView
contains_key_10_from_100 74,255 (+0.05%) 91 (${\color{green}\textbf{-9.00\%%}}$) 205 (+0.49%) 81,885 (+0.03%)
contains_key_10_from_1000 498,672 (+0.00%) 2,975 (+0.10%) 205 (+0.49%) 520,722 (+0.01%)
get_10_from_100 77,893 (+0.03%) 92 (No change) 212 (+0.47%) 85,773 (+0.07%)
get_10_from_1000 502,363 (+0.00%) 2,978 (+0.10%) 212 (+0.47%) 524,673 (+0.01%)
get_100_missing_from_1000 848,023 (+0.00%) 2,980 (-0.07%) 230 (No change) 870,973 (-0.00%)
indices_100 137,715 (No change) 227 (No change) 402 (No change) 152,920 (No change)
indices_1000 1,314,546 (+0.00%) 6,483 (-0.49%) 1,186 (+0.08%) 1,388,471 (-0.00%)
insert_100 354,967 (-0.00%) 93 (${\color{red}\textbf{+3.33\%%}}$) 654 (No change) 378,322 (+0.00%)
insert_1000 4,006,238 (+0.00%) 3,041 (-0.03%) 3,985 (No change) 4,160,918 (-0.00%)
post_save_1000 1,469,656 (No change) 11,208 (No change) 180 (No change) 1,531,996 (No change)
pre_save_100 461,079 (-0.01%) 769 (+0.26%) 613 (-0.16%) 486,379 (-0.01%)
pre_save_1000 4,744,766 (-0.00%) 10,152 (+0.37%) 3,815 (No change) 4,929,051 (+0.00%)
remove_500_from_1000 1,656,112 (-0.00%) 4,202 (No change) 179 (-0.56%) 1,683,387 (-0.00%)
QueueView / BucketQueueView
delete_500_from_1000 33,943 (-0.67%) 42 (${\color{red}\textbf{+16.67\%%}}$) 161 (-0.62%) 39,788 (-0.58%)
front_100_from_1000 8,248 (+0.33%) 36 (${\color{green}\textbf{-5.26\%%}}$) 136 (+0.74%) 13,188 (+0.40%)
pre_save_1000 60,125 (+0.00%) 59 (${\color{green}\textbf{-4.84\%%}}$) 286 (No change) 70,430 (-0.02%)
push_1000 33,113 (-0.00%) 49 (${\color{red}\textbf{+2.08\%%}}$) 160 (No change) 38,958 (+0.01%)
delete_500_from_1000 12,156 (-0.16%) 31 (${\color{green}\textbf{-13.89\%%}}$) 138 (-0.72%) 17,141 (-0.46%)
front_100_from_1000 13,679 (No change) 39 (No change) 163 (No change) 19,579 (No change)
pre_save_1000 1,493,908 (+0.00%) 2,733 (+0.07%) 1,967 (+0.05%) 1,576,418 (+0.00%)
push_1000 32,992 (-0.07%) 48 (${\color{green}\textbf{-5.88\%%}}$) 159 (-0.62%) 38,797 (-0.19%)
ReentrantCollectionView
contains_key_10_from_100 200,599 (-0.00%) 1,025 (+0.29%) 196 (No change) 212,584 (+0.01%)
indices_100 330,772 (-0.00%) 1,198 (+0.08%) 371 (No change) 349,747 (+0.00%)
load_all_100_from_storage 1,123,388 (+0.00%) 6,159 (No change) 410 (+0.24%) 1,168,533 (+0.01%)
load_all_100_in_memory 563,882 (+0.00%) 1,844 (No change) 545 (+0.18%) 592,177 (+0.01%)
pre_save_100 485,540 (+0.00%) 2,234 (-0.04%) 691 (No change) 520,895 (-0.00%)
RegisterView
get_set_100 119,877 (-0.02%) 42 (No change) 181 (-0.55%) 126,422 (-0.05%)
pre_save 7,880 (+0.36%) 44 (${\color{green}\textbf{-6.38\%%}}$) 165 (+0.61%) 13,875 (+0.35%)

Cache metrics fluctuate because anything that changes the virtual memory layout
shifts which data lands on which cache lines, changing the L1/LLC/RAM distribution.
Probable causes: ASLR (even across identical binaries), executable binary size changes,
shared library size changes, and even filename length differences.

Cachegrind simulates a two-level cache (L1 + LLC) auto-detected from the host CPU.
Est. Cycles = L1 hits + 5 × LLC hits + 35 × RAM hits.

Runner cache sizes: L1d cache: 64 KiB (2 instances);L1i cache: 64 KiB (2 instances) L2 cache: 1 MiB (2 instances);L3 cache: 32 MiB (1 instance)

@afck afck force-pushed the store-safety-dbg branch from 59d443c to 3fde7e5 Compare April 21, 2026 09:54
@afck afck force-pushed the store-safety-dbg branch from 3fde7e5 to 607219d Compare April 21, 2026 10:56
If the caller's future is dropped between `write_batch` landing in
storage and `post_save` refreshing the in-memory register views, the
views' cached `stored_value` goes stale while storage has advanced.
Setting the poison flag up front and clearing it only after `save`
fully returns makes the poison sticky on both error and cancellation,
so the next access evicts and reloads from storage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant