Skip to content
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

eth/tracers: refactor exporting js buffer #27472

Merged
merged 1 commit into from
Jun 14, 2023
Merged

Conversation

s1na
Copy link
Contributor

@s1na s1na commented Jun 14, 2023

We had to do this workaround because it wasn't possible to export typed arrays from JS to []byte. This was added in dop251/goja@2352993.

As a sanity check I ran the call tracer benchmarks. Seems there's mostly no change in performance.

❯ benchstat before.bench after.bench         
name                                          old time/op    new time/op    delta
Tracers/create-8                                85.0µs ± 2%    88.7µs ± 2%  +4.33%  (p=0.008 n=5+5)
Tracers/deepCalls-8                              504µs ± 1%     524µs ± 2%  +3.99%  (p=0.008 n=5+5)
Tracers/delegatecall-8                          52.4µs ± 1%    53.0µs ± 1%    ~     (p=0.310 n=5+5)
Tracers/innerCreateOogOuterThrow-8               273µs ± 1%     272µs ± 2%    ~     (p=0.690 n=5+5)
Tracers/innerInstafail-8                        14.2µs ± 2%    14.3µs ± 1%    ~     (p=0.690 n=5+5)
Tracers/innerThrowOuterRevert-8                 45.1µs ± 1%    44.6µs ± 1%    ~     (p=0.151 n=5+5)
Tracers/oog-8                                   26.4µs ± 1%    26.2µs ± 1%    ~     (p=0.095 n=5+5)
Tracers/revert-8                                17.5µs ± 1%    17.4µs ± 2%    ~     (p=0.333 n=5+5)
Tracers/revertReason-8                          24.7µs ± 1%    24.7µs ± 1%    ~     (p=0.690 n=5+5)
Tracers/selfdestruct-8                          22.7µs ± 3%    22.6µs ± 2%    ~     (p=0.421 n=5+5)
Tracers/simple-8                                30.0µs ± 1%    30.1µs ± 0%    ~     (p=0.190 n=5+4)
Tracers/simpleOnlytop-8                         30.0µs ± 1%    30.3µs ± 1%    ~     (p=0.222 n=5+5)
Tracers/throw-8                                 20.1µs ± 1%    20.3µs ± 1%    ~     (p=0.095 n=5+5)
FlatCallTracer/bigSlow-8                        10.2ms ± 2%    10.2ms ± 1%    ~     (p=0.690 n=5+5)
FlatCallTracer/callcodePrecompiledFailHide-8     366µs ± 2%     366µs ± 2%    ~     (p=0.841 n=5+5)
FlatCallTracer/callcodePrecompiledOog-8          436µs ± 2%     432µs ± 1%    ~     (p=0.095 n=5+5)
FlatCallTracer/callcodePrecompiledThrow-8        403µs ± 1%     404µs ± 2%    ~     (p=1.000 n=5+5)
FlatCallTracer/create-8                          655µs ± 2%     658µs ± 2%    ~     (p=0.690 n=5+5)
FlatCallTracer/deepCalls-8                      4.03ms ± 1%    4.01ms ± 1%    ~     (p=0.310 n=5+5)
FlatCallTracer/delegatecall-8                    830µs ± 1%     823µs ± 1%    ~     (p=0.222 n=5+5)
FlatCallTracer/delegatecallParentValue-8         449µs ± 1%     450µs ± 1%    ~     (p=0.690 n=5+5)
FlatCallTracer/gas-8                             537µs ± 5%     519µs ± 3%    ~     (p=0.056 n=5+5)
FlatCallTracer/includePrecompiled-8             3.00ms ± 1%    2.99ms ± 1%    ~     (p=1.000 n=5+5)
FlatCallTracer/innerCreateOogOuterThrow-8       1.49ms ± 1%    1.51ms ± 2%    ~     (p=0.095 n=5+5)
FlatCallTracer/innerInstafail-8                  381µs ± 2%     389µs ± 5%    ~     (p=0.310 n=5+5)
FlatCallTracer/innerPrecompiledWrongGas-8       1.53ms ± 1%    1.54ms ± 1%    ~     (p=0.111 n=5+4)
FlatCallTracer/innerThrowOuterRevert-8           948µs ± 0%     964µs ± 2%    ~     (p=0.057 n=4+4)
FlatCallTracer/nestedCreate-8                    611µs ± 3%     609µs ± 2%    ~     (p=0.841 n=5+5)
FlatCallTracer/nestedCreate2ActionGas-8          437µs ± 8%     414µs ± 1%    ~     (p=0.222 n=5+5)
FlatCallTracer/nestedCreateActionGas-8           442µs ± 4%     419µs ± 2%  -5.08%  (p=0.016 n=4+5)
FlatCallTracer/nestedCreateInerror-8             424µs ± 5%     414µs ± 4%    ~     (p=0.556 n=4+5)
FlatCallTracer/nestedPointerIssue-8             3.53ms ± 5%    3.38ms ± 1%  -4.47%  (p=0.008 n=5+5)
FlatCallTracer/oog-8                             569µs ± 6%     550µs ± 2%    ~     (p=0.095 n=5+5)
FlatCallTracer/optionConvertParityErrors-8       573µs ± 3%     550µs ± 1%  -4.11%  (p=0.008 n=5+5)
FlatCallTracer/resultOutput-8                    646µs ± 8%     619µs ± 1%  -4.25%  (p=0.016 n=5+5)
FlatCallTracer/revert-8                          460µs ± 4%     454µs ± 2%    ~     (p=0.690 n=5+5)
FlatCallTracer/revertReason-8                    530µs ± 2%     524µs ± 2%    ~     (p=0.310 n=5+5)
FlatCallTracer/selfdestruct-8                    405µs ± 1%     407µs ± 2%    ~     (p=0.548 n=5+5)
FlatCallTracer/simple-8                          598µs ± 3%     594µs ± 1%    ~     (p=0.421 n=5+5)
FlatCallTracer/simpleOnlytop-8                   607µs ± 3%     607µs ± 2%    ~     (p=0.841 n=5+5)
FlatCallTracer/skipNoBalanceError-8              474µs ± 1%     473µs ± 1%    ~     (p=0.413 n=4+5)
FlatCallTracer/staticcallPrecompiled-8          1.11ms ± 1%    1.12ms ± 3%    ~     (p=0.690 n=5+5)
FlatCallTracer/suicide-8                         450µs ± 1%     458µs ± 2%    ~     (p=0.095 n=5+5)
FlatCallTracer/throw-8                           671µs ±13%     625µs ± 2%  -6.86%  (p=0.016 n=5+5)

name                                          old alloc/op   new alloc/op   delta
Tracers/create-8                                37.1kB ± 0%    37.1kB ± 0%  +0.10%  (p=0.032 n=5+5)
Tracers/deepCalls-8                              108kB ± 0%     108kB ± 0%    ~     (p=1.000 n=5+5)
Tracers/delegatecall-8                          13.4kB ± 0%    13.4kB ± 0%    ~     (p=0.571 n=5+5)
Tracers/innerCreateOogOuterThrow-8               128kB ± 0%     128kB ± 0%    ~     (p=1.000 n=5+5)
Tracers/innerInstafail-8                        5.02kB ± 0%    5.02kB ± 0%    ~     (p=0.286 n=5+5)
Tracers/innerThrowOuterRevert-8                 9.83kB ± 0%    9.83kB ± 0%    ~     (p=0.651 n=5+4)
Tracers/oog-8                                   6.39kB ± 0%    6.39kB ± 0%    ~     (p=0.333 n=5+4)
Tracers/revert-8                                6.58kB ± 0%    6.58kB ± 0%    ~     (p=0.468 n=5+5)
Tracers/revertReason-8                          8.69kB ± 0%    8.68kB ± 0%    ~     (p=0.690 n=5+5)
Tracers/selfdestruct-8                          7.72kB ± 0%    7.72kB ± 0%    ~     (p=0.651 n=5+4)
Tracers/simple-8                                8.17kB ± 0%    8.17kB ± 0%    ~     (p=0.079 n=4+5)
Tracers/simpleOnlytop-8                         8.17kB ± 0%    8.17kB ± 0%    ~     (p=0.190 n=5+5)
Tracers/throw-8                                 5.51kB ± 0%    5.51kB ± 0%    ~     (p=1.000 n=5+5)

name                                          old allocs/op  new allocs/op  delta
Tracers/create-8                                   101 ± 0%       101 ± 0%    ~     (all equal)
Tracers/deepCalls-8                                685 ± 0%       685 ± 0%    ~     (all equal)
Tracers/delegatecall-8                             126 ± 0%       126 ± 0%    ~     (all equal)
Tracers/innerCreateOogOuterThrow-8                 125 ± 0%       125 ± 0%    ~     (all equal)
Tracers/innerInstafail-8                          79.0 ± 0%      79.0 ± 0%    ~     (all equal)
Tracers/innerThrowOuterRevert-8                    111 ± 0%       111 ± 0%    ~     (all equal)
Tracers/oog-8                                     74.0 ± 0%      74.0 ± 0%    ~     (all equal)
Tracers/revert-8                                  75.0 ± 0%      75.0 ± 0%    ~     (all equal)
Tracers/revertReason-8                            96.0 ± 0%      96.0 ± 0%    ~     (all equal)
Tracers/selfdestruct-8                             112 ± 0%       112 ± 0%    ~     (all equal)
Tracers/simple-8                                   110 ± 0%       110 ± 0%    ~     (all equal)
Tracers/simpleOnlytop-8                            110 ± 0%       110 ± 0%    ~     (all equal)
Tracers/throw-8                                   70.0 ± 0%      70.0 ± 0%    ~     (all equal)

@fjl fjl merged commit 7823ff6 into ethereum:master Jun 14, 2023
@fjl fjl added this to the 1.12.1 milestone Jun 14, 2023
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
We had to do this workaround because it wasn't possible to export typed arrays from
JS to []byte. This was added in dop251/goja@2352993, so we can use the better way now.
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
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