db/seg: drop redundant posTable.ptrs pointer array#21927
Merged
Conversation
Giulio2002
approved these changes
Jun 21, 2026
Giulio2002
left a comment
Contributor
There was a problem hiding this comment.
LGTM — straightforward refactor removing the redundant posTable.ptrs array by storing subtable indexes directly in posEntry, with matching getter/build updates and no behavior change.
The position Huffman table kept two parallel per-slot arrays: entries (pos+bits) and ptrs (child subtable pointers). Per slot only one is ever used — a slot is either a terminal (bits!=0) or a subtable router (bits==0), and routers leave posEntry.pos unused. Since all subtables live in posArena.tables, the child reference fits in that free pos field as a uint32 index, making the whole ptrs array removable. Saves a full per-slot pointer array (~73MB resident on a mainnet datadir in profiling) and removes those pointers from the GC scan set. No format or behavior change.
29dc1ec to
4a16c19
Compare
JkLondon
approved these changes
Jun 22, 2026
Fix the posEntry comment to note that bits==0 means subtable router on the posMask!=0 path only; the posMask==0 single-symbol case returns pos directly without consulting bits. Add TestDecompressDeepPositionSubtable: 600 words with a common pattern at 600 distinct byte positions force posMaxDepth=10>9, creating subtables and exercising nextPosSubtable end-to-end.
AskAlexSharov
added a commit
that referenced
this pull request
Jul 1, 2026
…-fold fix #21945) (#22129) Refreshes `bal-devnet-7_warmup` onto `bal-devnet-7`, pulling in the parallel deep-storage-fold trie-root fix #21945 (and its feature line #21709, #21941). ### `sstore_bloated` MGas/s | variant | base (par-kvi, BAL) | ethrex | now (+#21945) | |---|--:|--:|--:| | `sstore_bloated` (F) — new slots | 92 | 461 | 399 | | `sstore_bloated` (T) — existing slots | 7 | 82 | 30 | ### Notes Rendered as a merge, so review the conflict resolutions rather than the upstream commits: - `commitment_convert.go` / `_blackbox_test.go`: took bal-devnet-7's merged form (#21933) over the pre-merge draft. - `db/seg/decompress.go`: comment-only, took bal-devnet-7 (#21927). - `rawdbreset/reset_stages.go`: combined out-of-tx `ClearTables` with bal-devnet-7's branchCache invalidation. - `stage_execute.go`: kept warmup's `PruneExecutionStage` (`haveMore` signature, required by callers). bal-devnet-7's #20860 prune-timeout budget-sharing is **not** carried into this function. - `cmd/integration/commands/stages.go`: took bal-devnet-7's `stageExec` (drops the removed `--no-commit` flag), adapted its prune calls to the `haveMore` signature. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: lystopad <oleksandr.lystopad@erigon.tech> Co-authored-by: kewei <kewei.train@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Andrew Ashikhmin <34320705+yperbasis@users.noreply.github.com> Co-authored-by: Alex Sharov <AskAlexSharov@gmail.com> Co-authored-by: lupin012 <58134934+lupin012@users.noreply.github.com> Co-authored-by: Mark Holt <135143369+mh0lt@users.noreply.github.com> Co-authored-by: Mark Holt <erigon@dev-bm-e3-ethmainnet-n4.erigon.io> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: awskii <awskii@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: erigon-copilot[bot] <265817861+erigon-copilot[bot]@users.noreply.github.com> Co-authored-by: erigon-copilot[bot] <erigon-copilot[bot]@users.noreply.github.com> Co-authored-by: Giulio Rebuffo <giulio.rebuffo@gmail.com> Co-authored-by: Ilya Mikheev <54912776+JkLondon@users.noreply.github.com> Co-authored-by: JkLondon <me@ilyamikheev.com> Co-authored-by: bloxster <bloxster@proton.me> Co-authored-by: Bloxster <gianni.morselli@erigon.tech> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Co-authored-by: yperbasis <andrey.ashikhmin@gmail.com> Co-authored-by: noop <noop@noop> Co-authored-by: Sudeep Kumar <sudeep.kumar@erigon.tech> Co-authored-by: bloxster <bloxster@users.noreply.github.com> Co-authored-by: info@weblogix.biz <admin@10gbps.weblogix.it> Co-authored-by: Sahil Sojitra <88416181+Sahil-4555@users.noreply.github.com> Co-authored-by: awskii <artem.tsskiy@gmail.com> Co-authored-by: Michelangelo Riccobene <michelangelo.riccobene@gmail.com> Co-authored-by: Matt Joiner <anacrolix@gmail.com> Co-authored-by: milen <94537774+taratorio@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.