Skip to content

triedb/pathdb: use binary.append to eliminate the tmp scratch slice #32250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 22, 2025

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jul 21, 2025

binary.AppendUvarint offers better performance than using append directly, because it avoids unnecessary memory allocation and copying.

In our case, it can increase the performance by +35.8% for the blockWriter.append function:

benchmark                        old ns/op     new ns/op     delta
BenchmarkBlockWriterAppend-8     5.97          3.83          -35.80%

@jsvisa jsvisa requested a review from rjl493456442 as a code owner July 21, 2025 09:37
@rjl493456442 rjl493456442 self-assigned this Jul 21, 2025
@rjl493456442 rjl493456442 added this to the 1.16.2 milestone Jul 22, 2025
@rjl493456442 rjl493456442 merged commit 264c06a into ethereum:master Jul 22, 2025
2 of 5 checks passed
@jsvisa jsvisa deleted the index-block-stratch branch July 22, 2025 13:35
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.

2 participants