Skip to content

perf: reuse hash buffer in witness storage leaf hash#18803

Merged
yperbasis merged 1 commit into
erigontech:mainfrom
lisenokdonbassenok:perf/avoid-witness-storage-leaf-alloc
Jan 26, 2026
Merged

perf: reuse hash buffer in witness storage leaf hash#18803
yperbasis merged 1 commit into
erigontech:mainfrom
lisenokdonbassenok:perf/avoid-witness-storage-leaf-alloc

Conversation

@lisenokdonbassenok
Copy link
Copy Markdown
Contributor

Previously witnessComputeCellHashWithStorage allocated a fresh []byte with make([]byte, 0, 33) for every singleton storage leaf when computing the leaf hash. This added a small but unnecessary allocation on a hot path during witness generation.

This change reuses the existing hph.hashAuxBuffer slice as the target buffer for leafHashWithKeyVal in the singleton storage branch. The hash encoding semantics stay the same, but we avoid per-call allocations in the witness storage leaf hashing path.

@yperbasis yperbasis enabled auto-merge (squash) January 26, 2026 10:41
@yperbasis yperbasis merged commit 748ac84 into erigontech:main Jan 26, 2026
15 of 16 checks passed
mattevans added a commit to ethpandaops/erigone-legacy that referenced this pull request Jan 28, 2026
* main: (37 commits)
  Make `lastCommittedTxNum` atomic (erigontech#18820)
  integrity: fix redundant variable name in checkLogIdx (erigontech#18646)
  Fixed index building for v0 snapshot format (erigontech#18825)
  execution/vm: fold EVMInterpreter into EVM (erigontech#18765)
  fix: return correct prune mode value instead of nil (erigontech#18804)
  fix BuildMissedAccessors for caplin state (erigontech#18802)
  execution: EIP-7708: ETH transfers emit a log (erigontech#18761)
  refactor(rpc): remove redundant boolean comparison in AccountRange (erigontech#18814)
  Show the default P2P discovery bools in --help (erigontech#18818)
  fix(txpool): remove redundant Worst() calls in queued pool discard loop (erigontech#18810)
  node: remove unused logger and test helper (erigontech#18744)
  Disabled compression in collate function (erigontech#18813)
  Add missing tx.Commit() in stage_snapshots (erigontech#18816)
  Bumped major version of snapshot files (erigontech#18815)
  qa-tests: summary for RPC integration tests (erigontech#18809)
  perf: reuse hash buffer in witness storage leaf hash (erigontech#18803)
  execution/stagedsync: remove canPrune from serial_exec (erigontech#18800)
  Fixed deduplication intervals for rebuild cmd (erigontech#18796)
  Fix race due to warmup cache (erigontech#18799)
  fix(txpool): use instance logger instead of global log (erigontech#18797)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants