Skip to content

db/seg: drop redundant posTable.ptrs pointer array#21927

Merged
AskAlexSharov merged 2 commits into
mainfrom
alex/dict_no_ptrs_36
Jun 23, 2026
Merged

db/seg: drop redundant posTable.ptrs pointer array#21927
AskAlexSharov merged 2 commits into
mainfrom
alex/dict_no_ptrs_36

Conversation

@AskAlexSharov

@AskAlexSharov AskAlexSharov commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Giulio2002 Giulio2002 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@AskAlexSharov AskAlexSharov requested a review from JkLondon June 21, 2026 10:16
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread db/seg/decompress.go Outdated
Comment thread db/seg/decompress.go
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 AskAlexSharov enabled auto-merge June 23, 2026 03:23
@AskAlexSharov AskAlexSharov added this pull request to the merge queue Jun 23, 2026
Merged via the queue into main with commit 988360a Jun 23, 2026
91 checks passed
@AskAlexSharov AskAlexSharov deleted the alex/dict_no_ptrs_36 branch June 23, 2026 04:37
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>
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.

4 participants