diff options
author | Martin Holst Swende <martin@swende.se> | 2018-10-04 23:15:37 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2018-10-04 23:15:37 +0800 |
commit | 89a32451aeb418db3fd5d9c427a0c29fddb1e85b (patch) | |
tree | 24df0d470d52030635712364a947bc7a8293d366 /core/vm/analysis_test.go | |
parent | 8c63d0d2e44128c6a0f12fb9db8f0a32528b4a7d (diff) | |
download | dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.gz dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.bz2 dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.lz dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.xz dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.tar.zst dexon-89a32451aeb418db3fd5d9c427a0c29fddb1e85b.zip |
core/vm: faster create/create2 (#17806)
* core/vm/runtim: benchmark create/create2
* core/vm: do less hashing in CREATE2
* core/vm: avoid storing jumpdest analysis for initcode
* core/vm: avoid unneccesary lookups, remove unused fields
* core/vm: go formatting tests
* core/vm: save jumpdest analysis locally
* core/vm: use common.Hash instead of nil, fix review comments
* core/vm: removed type destinations
* core/vm: correct check for empty hash
* eth: more elegant api_tracer
* core/vm: address review concerns
Diffstat (limited to 'core/vm/analysis_test.go')
-rw-r--r-- | core/vm/analysis_test.go | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/core/vm/analysis_test.go b/core/vm/analysis_test.go index a64f90ed9..fd2d744d8 100644 --- a/core/vm/analysis_test.go +++ b/core/vm/analysis_test.go @@ -16,7 +16,11 @@ package vm -import "testing" +import ( + "testing" + + "github.com/ethereum/go-ethereum/crypto" +) func TestJumpDestAnalysis(t *testing.T) { tests := []struct { @@ -49,5 +53,23 @@ func TestJumpDestAnalysis(t *testing.T) { t.Fatalf("expected %x, got %02x", test.exp, ret[test.which]) } } +} +func BenchmarkJumpdestAnalysis_1200k(bench *testing.B) { + // 1.4 ms + code := make([]byte, 1200000) + bench.ResetTimer() + for i := 0; i < bench.N; i++ { + codeBitmap(code) + } + bench.StopTimer() +} +func BenchmarkJumpdestHashing_1200k(bench *testing.B) { + // 4 ms + code := make([]byte, 1200000) + bench.ResetTimer() + for i := 0; i < bench.N; i++ { + crypto.Keccak256Hash(code) + } + bench.StopTimer() } |