Skip to content

[wip] another btree#19742

Open
AskAlexSharov wants to merge 13 commits into
mainfrom
alex/bt_35
Open

[wip] another btree#19742
AskAlexSharov wants to merge 13 commits into
mainfrom
alex/bt_35

Conversation

@AskAlexSharov

@AskAlexSharov AskAlexSharov commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

for: #17988

 ┌─────────────────────────┬────────────────┬──────────────────┬─────────────────────────────┐
  │        Operation        │   anacrolix    │     tidwall      │              Δ              │
  ├─────────────────────────┼────────────────┼──────────────────┼─────────────────────────────┤
  │ Set 100k keys           │ 23 ms, 10.8 MB │ 26.7 ms, 15.6 MB │ 14% faster, 31% less memory │
  ├─────────────────────────┼────────────────┼──────────────────┼─────────────────────────────┤
  │ Set 10k keys            │ 1.5 ms, 1.1 MB │ 1.8 ms, 1.7 MB   │ 14% faster, 35% less memory │
  ├─────────────────────────┼────────────────┼──────────────────┼─────────────────────────────┤
  │ Get (random, 100k map)  │ 203 ns         │ 210 ns           │ ~3% faster                  │
  ├─────────────────────────┼────────────────┼──────────────────┼─────────────────────────────┤
  │ SetGet (mixed, 10k map) │ 211 ns         │ 221 ns           │ ~5% faster                  │
  └─────────────────────────┴────────────────┴──────────────────┴─────────────────────────────┘

see also:
anacrolix/btree#1
anacrolix/btree#3

@Giulio2002 Giulio2002 added github_actions Pull requests that update GitHub Actions code ErigonDB performance labels Mar 10, 2026

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

Switches the in-memory ordered map used for StorageDomain buffering from tidwall/btree to anacrolix/btree, aligning with the performance/memory investigation in #17988 and keeping prefix-iteration support intact in the state aggregator pipeline.

Changes:

  • Promote github.com/anacrolix/btree v0.1.1 to a direct dependency in go.mod.
  • Replace tidwall/btree map usage in TemporalMemBatch with anacrolix/btree (MakeMap, Upsert, Iterator, Reset).
  • Adapt the storage-domain prefix-iteration path (debugIteratePrefixLatest) to consume an *anacrolix/btree.Map and its iterator API.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
go.mod Makes github.com/anacrolix/btree a direct requirement (was indirect).
db/state/temporal_mem_batch.go Migrates the StorageDomain in-RAM structure to anacrolix/btree and updates write/clear/merge logic accordingly.
db/state/domain_stream.go Updates the RAM portion of the multi-source prefix iterator to use anacrolix/btree iterators.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@anacrolix anacrolix self-assigned this Apr 14, 2026

@yperbasis yperbasis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Submodule execution-spec-tests should not change

@yperbasis yperbasis dismissed their stale review April 29, 2026 07:35

addressed

@anacrolix anacrolix removed their assignment May 15, 2026
@anacrolix

Copy link
Copy Markdown
Contributor

I'll bow out of pushing this one for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ErigonDB github_actions Pull requests that update GitHub Actions code performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants