Skip to content

feat: Use binary search in GetPrecompileModuleByAddress#31

Open
drklee3 wants to merge 4 commits into
masterfrom
dl-registry-binary-search
Open

feat: Use binary search in GetPrecompileModuleByAddress#31
drklee3 wants to merge 4 commits into
masterfrom
dl-registry-binary-search

Conversation

@drklee3

@drklee3 drklee3 commented May 1, 2024

Copy link
Copy Markdown

Benchmarks w/ 1000 registered modules (benchmarks included in pr):

goos: darwin
goarch: arm64
pkg: github.com/ethereum/go-ethereum/precompile/modules
                                │   old.txt    │              new.txt               │
                                │    sec/op    │   sec/op     vs base               │
GetPrecompileModuleByAddress-12   1460.5n ± 1%   319.1n ± 1%  -78.15% (p=0.002 n=6)

                                │  old.txt   │            new.txt            │
                                │    B/op    │    B/op     vs base           │
GetPrecompileModuleByAddress-12   7.000 ± 0%   7.000 ± 0%  ~ (p=1.000 n=6) ¹
¹ all samples are equal

                                │  old.txt   │            new.txt            │
                                │ allocs/op  │ allocs/op   vs base           │
GetPrecompileModuleByAddress-12   0.000 ± 0%   0.000 ± 0%  ~ (p=1.000 n=6) ¹
¹ all samples are equal

resolves #29

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.

Refactor stateful precompile look ups to use binary search

1 participant