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

core/vm: faster code analysis #23381

Merged
merged 11 commits into from Aug 24, 2021
Merged

core/vm: faster code analysis #23381

merged 11 commits into from Aug 24, 2021

Conversation

@holiman
Copy link
Contributor

@holiman holiman commented Aug 11, 2021

This makes the analysis for code/data faster, and more evenly spread. Previously, the worst-performing case was PUSH7.
PUSH1 started at ~40ns, and going upwards towards 50ms at PUSH7.
This PR doesn't improve the PUSH1 situation, but does markedly improve the (previous) worst-case quite a lot, and also the normal-case (for code which is not push).

name                           old time/op  new time/op  delta
JumpdestOpAnalysis/PUSH1-6     39.7ns ± 3%  40.2ns ± 0%     ~     (p=0.151 n=5+5)
JumpdestOpAnalysis/PUSH2-6     39.4ns ± 0%  38.6ns ± 3%     ~     (p=0.190 n=4+5)
JumpdestOpAnalysis/PUSH3-6     41.4ns ± 1%  31.5ns ± 3%  -23.83%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH4-6     44.5ns ± 6%  23.7ns ± 5%  -46.72%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH5-6     47.7ns ± 5%  22.0ns ± 1%  -53.95%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH6-6     47.2ns ± 1%  20.3ns ± 1%  -57.03%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH7-6     48.7ns ± 2%  18.1ns ± 5%  -62.91%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH8-6     12.0ns ± 2%  19.4ns ±12%  +60.79%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH9-6     15.2ns ± 0%  15.4ns ± 4%     ~     (p=0.460 n=4+5)
JumpdestOpAnalysis/PUSH10-6    18.8ns ± 1%  19.0ns ± 1%     ~     (p=0.095 n=5+5)
JumpdestOpAnalysis/PUSH11-6    22.2ns ± 9%  18.0ns ± 4%  -18.52%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH12-6    24.1ns ± 5%  16.0ns ± 6%  -33.56%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH13-6    25.9ns ± 4%  15.3ns ± 4%  -40.92%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH14-6    27.2ns ± 0%  15.0ns ± 2%  -44.80%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH15-6    29.1ns ± 0%  13.6ns ± 1%  -53.15%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH16-6    11.0ns ± 2%  13.7ns ± 5%  +24.60%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH17-6    12.9ns ± 1%  13.0ns ± 2%     ~     (p=0.905 n=4+5)
JumpdestOpAnalysis/PUSH18-6    15.1ns ± 0%  15.3ns ± 1%   +0.75%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH19-6    16.8ns ± 1%  15.0ns ± 1%  -10.72%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH20-6    19.8ns ±15%  14.1ns ± 6%  -28.64%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH21-6    21.5ns ±20%  13.3ns ± 0%  -38.33%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH22-6    21.2ns ± 1%  13.4ns ± 5%  -36.65%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH23-6    23.0ns ± 2%  12.8ns ± 3%  -44.43%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH24-6    10.8ns ± 3%  12.9ns ± 3%  +19.24%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH25-6    12.1ns ± 1%  12.6ns ± 5%   +4.83%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH26-6    13.4ns ± 0%  14.2ns ± 1%   +5.45%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH27-6    15.1ns ± 0%  13.7ns ± 0%   -9.64%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH28-6    16.1ns ± 2%  13.2ns ± 6%  -18.02%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH29-6    17.5ns ± 6%  12.9ns ± 2%  -26.38%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH30-6    18.4ns ± 0%  13.0ns ± 7%  -29.39%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH31-6    19.7ns ± 1%  12.3ns ± 1%  -37.36%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH32-6    10.6ns ± 2%  12.5ns ± 5%  +17.95%  (p=0.008 n=5+5)
JumpdestOpAnalysis/JUMPDEST-6  38.9ns ± 5%  20.1ns ± 1%  -48.29%  (p=0.008 n=5+5)
JumpdestOpAnalysis/STOP-6      38.8ns ± 4%  20.3ns ± 5%  -47.68%  (p=0.008 n=5+5)
@holiman
Copy link
Contributor Author

@holiman holiman commented Aug 11, 2021

Last commit improves the worst-performing case somewhat.
Difference without and with the last commit:

[user@work vm]$ benchstat final2.txt final3.txt 
name                           old time/op  new time/op  delta
JumpdestOpAnalysis/PUSH1-6     40.2ns ± 0%  31.0ns ± 1%  -22.95%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH2-6     38.6ns ± 3%  38.8ns ± 8%     ~     (p=0.333 n=5+5)
JumpdestOpAnalysis/PUSH3-6     31.5ns ± 3%  28.6ns ± 6%   -9.38%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH4-6     23.7ns ± 5%  25.1ns ± 7%     ~     (p=0.222 n=5+5)
JumpdestOpAnalysis/PUSH5-6     22.0ns ± 1%  21.4ns ± 4%     ~     (p=0.190 n=4+5)
JumpdestOpAnalysis/PUSH6-6     20.3ns ± 1%  19.0ns ± 3%   -6.31%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH7-6     18.1ns ± 5%  17.7ns ± 2%     ~     (p=0.310 n=5+5)
JumpdestOpAnalysis/PUSH8-6     19.4ns ±12%  20.0ns ± 0%     ~     (p=0.730 n=5+4)
JumpdestOpAnalysis/PUSH9-6     15.4ns ± 4%  16.2ns ± 7%     ~     (p=0.056 n=5+5)
JumpdestOpAnalysis/PUSH10-6    19.0ns ± 1%  19.6ns ± 0%   +3.18%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH11-6    18.0ns ± 4%  19.7ns ±11%   +9.19%  (p=0.040 n=5+5)
JumpdestOpAnalysis/PUSH12-6    16.0ns ± 6%  17.0ns ± 5%     ~     (p=0.056 n=5+5)
JumpdestOpAnalysis/PUSH13-6    15.3ns ± 4%  15.6ns ± 5%     ~     (p=0.222 n=5+5)
JumpdestOpAnalysis/PUSH14-6    15.0ns ± 2%  15.7ns ± 6%     ~     (p=0.056 n=5+5)
JumpdestOpAnalysis/PUSH15-6    13.6ns ± 1%  14.4ns ± 2%   +5.48%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH16-6    13.7ns ± 5%  14.1ns ± 0%     ~     (p=0.190 n=5+4)
JumpdestOpAnalysis/PUSH17-6    13.0ns ± 2%  13.9ns ± 4%   +7.57%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH18-6    15.3ns ± 1%  15.4ns ± 5%     ~     (p=0.984 n=5+5)
JumpdestOpAnalysis/PUSH19-6    15.0ns ± 1%  15.2ns ± 0%   +1.41%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH20-6    14.1ns ± 6%  14.5ns ± 2%     ~     (p=0.151 n=5+5)
JumpdestOpAnalysis/PUSH21-6    13.3ns ± 0%  13.9ns ± 6%   +4.64%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH22-6    13.4ns ± 5%  14.1ns ± 7%   +5.09%  (p=0.048 n=5+5)
JumpdestOpAnalysis/PUSH23-6    12.8ns ± 3%  13.4ns ±10%     ~     (p=0.056 n=5+5)
JumpdestOpAnalysis/PUSH24-6    12.9ns ± 3%  12.5ns ± 1%   -2.43%  (p=0.032 n=5+5)
JumpdestOpAnalysis/PUSH25-6    12.6ns ± 5%  12.5ns ± 4%     ~     (p=0.452 n=5+5)
JumpdestOpAnalysis/PUSH26-6    14.2ns ± 1%  14.1ns ± 2%     ~     (p=0.167 n=5+5)
JumpdestOpAnalysis/PUSH27-6    13.7ns ± 0%  13.7ns ± 1%     ~     (p=0.190 n=4+5)
JumpdestOpAnalysis/PUSH28-6    13.2ns ± 6%  13.2ns ± 6%     ~     (p=0.968 n=5+5)
JumpdestOpAnalysis/PUSH29-6    12.9ns ± 2%  12.6ns ± 3%     ~     (p=0.095 n=5+5)
JumpdestOpAnalysis/PUSH30-6    13.0ns ± 7%  12.6ns ± 0%   -3.15%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH31-6    12.3ns ± 1%  12.3ns ± 6%     ~     (p=0.135 n=5+5)
JumpdestOpAnalysis/PUSH32-6    12.5ns ± 5%  12.3ns ± 4%     ~     (p=0.421 n=5+5)
JumpdestOpAnalysis/JUMPDEST-6  20.1ns ± 1%  20.0ns ± 2%     ~     (p=0.222 n=5+5)
JumpdestOpAnalysis/STOP-6      20.3ns ± 5%  19.8ns ± 1%   -2.35%  (p=0.008 n=5+5)

And final performance diff against master:

[user@work vm]$ benchstat before.txt final3.txt 
name                           old time/op  new time/op  delta
JumpdestOpAnalysis/PUSH1-6     39.7ns ± 3%  31.0ns ± 1%  -22.01%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH2-6     39.4ns ± 0%  38.8ns ± 8%     ~     (p=0.190 n=4+5)
JumpdestOpAnalysis/PUSH3-6     41.4ns ± 1%  28.6ns ± 6%  -30.97%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH4-6     44.5ns ± 6%  25.1ns ± 7%  -43.65%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH5-6     47.7ns ± 5%  21.4ns ± 4%  -55.22%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH6-6     47.2ns ± 1%  19.0ns ± 3%  -59.74%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH7-6     48.7ns ± 2%  17.7ns ± 2%  -63.62%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH8-6     12.0ns ± 2%  20.0ns ± 0%  +65.75%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH9-6     15.2ns ± 0%  16.2ns ± 7%   +6.39%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH10-6    18.8ns ± 1%  19.6ns ± 0%   +4.40%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH11-6    22.2ns ± 9%  19.7ns ±11%     ~     (p=0.056 n=5+5)
JumpdestOpAnalysis/PUSH12-6    24.1ns ± 5%  17.0ns ± 5%  -29.65%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH13-6    25.9ns ± 4%  15.6ns ± 5%  -39.79%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH14-6    27.2ns ± 0%  15.7ns ± 6%  -42.52%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH15-6    29.1ns ± 0%  14.4ns ± 2%  -50.59%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH16-6    11.0ns ± 2%  14.1ns ± 0%  +28.85%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH17-6    12.9ns ± 1%  13.9ns ± 4%   +7.74%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH18-6    15.1ns ± 0%  15.4ns ± 5%   +1.83%  (p=0.032 n=4+5)
JumpdestOpAnalysis/PUSH19-6    16.8ns ± 1%  15.2ns ± 0%   -9.46%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH20-6    19.8ns ±15%  14.5ns ± 2%  -26.85%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH21-6    21.5ns ±20%  13.9ns ± 6%  -35.47%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH22-6    21.2ns ± 1%  14.1ns ± 7%  -33.42%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH23-6    23.0ns ± 2%  13.4ns ±10%  -41.64%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH24-6    10.8ns ± 3%  12.5ns ± 1%  +16.34%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH25-6    12.1ns ± 1%  12.5ns ± 4%   +3.92%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH26-6    13.4ns ± 0%  14.1ns ± 2%   +4.86%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH27-6    15.1ns ± 0%  13.7ns ± 1%   -9.36%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH28-6    16.1ns ± 2%  13.2ns ± 6%  -17.94%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH29-6    17.5ns ± 6%  12.6ns ± 3%  -28.04%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH30-6    18.4ns ± 0%  12.6ns ± 0%  -31.61%  (p=0.029 n=4+4)
JumpdestOpAnalysis/PUSH31-6    19.7ns ± 1%  12.3ns ± 6%  -37.41%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH32-6    10.6ns ± 2%  12.3ns ± 4%  +16.30%  (p=0.008 n=5+5)
JumpdestOpAnalysis/JUMPDEST-6  38.9ns ± 5%  20.0ns ± 2%  -48.64%  (p=0.008 n=5+5)
JumpdestOpAnalysis/STOP-6      38.8ns ± 4%  19.8ns ± 1%  -48.91%  (p=0.008 n=5+5)

@holiman
Copy link
Contributor Author

@holiman holiman commented Aug 11, 2021

oh right. Here's the old benchmark that we already had. It's quite naive, just a large segment of zeroes:

$ benchstat 0.txt 1.txt 
name                      old time/op  new time/op  delta
JumpdestAnalysis_1200k-6  1.24ms ± 6%  0.70ms ± 1%  -43.57%  (p=0.000 n=9+8)
JumpdestHashing_1200k-6   3.80ms ± 1%  3.59ms ±13%     ~     (p=0.070 n=7+10)

@holiman
Copy link
Contributor Author

@holiman holiman commented Aug 14, 2021

Further incremental improvements, by

  • avoiding writing the 'next' byte if not needed
  • setting, instead or OR ing, the next byte

Total improvements:

name                           old time/op  new time/op  delta
JumpdestOpAnalysis/PUSH1-6     39.7ns ± 3%  31.5ns ± 5%  -20.84%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH2-6     39.4ns ± 0%  30.9ns ± 3%  -21.64%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH3-6     41.4ns ± 1%  24.6ns ± 1%  -40.61%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH4-6     44.5ns ± 6%  20.9ns ± 6%  -53.14%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH5-6     47.7ns ± 5%  19.9ns ± 4%  -58.38%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH6-6     47.2ns ± 1%  17.2ns ± 5%  -63.60%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH7-6     48.7ns ± 2%  15.4ns ± 4%  -68.30%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH8-6     12.0ns ± 2%  15.1ns ± 0%  +25.62%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH9-6     15.2ns ± 0%  15.1ns ± 4%     ~     (p=0.190 n=4+5)
JumpdestOpAnalysis/PUSH10-6    18.8ns ± 1%  15.6ns ± 0%  -16.83%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH11-6    22.2ns ± 9%  15.5ns ± 3%  -29.98%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH12-6    24.1ns ± 5%  13.7ns ± 2%  -43.05%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH13-6    25.9ns ± 4%  13.5ns ± 5%  -47.69%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH14-6    27.2ns ± 0%  13.0ns ± 5%  -52.24%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH15-6    29.1ns ± 0%  12.3ns ± 1%  -57.63%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH16-6    11.0ns ± 2%  12.6ns ± 0%  +14.86%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH17-6    12.9ns ± 1%  12.8ns ± 1%   -1.43%  (p=0.032 n=4+5)
JumpdestOpAnalysis/PUSH18-6    15.1ns ± 0%  13.4ns ± 5%  -11.69%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH19-6    16.8ns ± 1%  13.3ns ± 6%  -20.74%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH20-6    19.8ns ±15%  12.3ns ± 6%  -37.77%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH21-6    21.5ns ±20%  12.4ns ± 4%  -42.31%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH22-6    21.2ns ± 1%  11.9ns ± 5%  -43.84%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH23-6    23.0ns ± 2%  11.5ns ± 2%  -49.73%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH24-6    10.8ns ± 3%  11.8ns ± 0%   +9.05%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH25-6    12.1ns ± 1%  12.1ns ± 1%     ~     (p=1.000 n=4+5)
JumpdestOpAnalysis/PUSH26-6    13.4ns ± 0%  12.4ns ± 5%   -7.69%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH27-6    15.1ns ± 0%  12.3ns ± 1%  -18.66%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH28-6    16.1ns ± 2%  11.9ns ± 6%  -26.00%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH29-6    17.5ns ± 6%  11.8ns ± 1%  -32.93%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH30-6    18.4ns ± 0%  11.4ns ± 1%  -37.82%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH31-6    19.7ns ± 1%  11.4ns ± 5%  -42.16%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH32-6    10.6ns ± 2%  11.4ns ± 0%   +7.38%  (p=0.008 n=5+5)
JumpdestOpAnalysis/JUMPDEST-6  38.9ns ± 5%  20.0ns ± 2%  -48.50%  (p=0.008 n=5+5)
JumpdestOpAnalysis/STOP-6      38.8ns ± 4%  19.8ns ± 0%  -48.97%  (p=0.016 n=5+4)

@holiman holiman force-pushed the faster_analysis branch from 2cdf4ab to 66ce675 Aug 14, 2021
@holiman
Copy link
Contributor Author

@holiman holiman commented Aug 14, 2021

New total improvements:

JumpdestOpAnalysis/PUSH1-6     39.7ns ± 3%  31.1ns ± 5%  -21.68%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH2-6     39.4ns ± 0%  32.4ns ±10%  -17.97%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH3-6     41.4ns ± 1%  22.8ns ± 5%  -44.98%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH4-6     44.5ns ± 6%  20.4ns ± 7%  -54.19%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH5-6     47.7ns ± 5%  18.1ns ± 5%  -62.03%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH6-6     47.2ns ± 1%  15.6ns ± 3%  -66.97%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH7-6     48.7ns ± 2%  14.4ns ± 2%  -70.48%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH8-6     12.0ns ± 2%  15.1ns ± 0%  +25.58%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH9-6     15.2ns ± 0%  15.5ns ± 4%     ~     (p=0.206 n=4+5)
JumpdestOpAnalysis/PUSH10-6    18.8ns ± 1%  15.9ns ± 0%  -15.50%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH11-6    22.2ns ± 9%  15.3ns ± 0%  -30.94%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH12-6    24.1ns ± 5%  14.5ns ± 3%  -40.11%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH13-6    25.9ns ± 4%  14.1ns ± 3%  -45.71%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH14-6    27.2ns ± 0%  12.9ns ± 0%  -52.48%  (p=0.029 n=4+4)
JumpdestOpAnalysis/PUSH15-6    29.1ns ± 0%  12.6ns ± 3%  -56.66%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH16-6    11.0ns ± 2%  10.1ns ± 2%   -7.69%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH17-6    12.9ns ± 1%  10.0ns ± 4%  -23.08%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH18-6    15.1ns ± 0%  10.7ns ± 1%  -29.27%  (p=0.029 n=4+4)
JumpdestOpAnalysis/PUSH19-6    16.8ns ± 1%  10.6ns ± 1%  -36.50%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH20-6    19.8ns ±15%  10.3ns ± 0%  -47.94%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH21-6    21.5ns ±20%  10.6ns ±12%  -50.76%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH22-6    21.2ns ± 1%  10.2ns ±14%  -52.03%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH23-6    23.0ns ± 2%  10.1ns ±13%  -56.11%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH24-6    10.8ns ± 3%   9.7ns ± 4%  -10.49%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH25-6    12.1ns ± 1%   9.9ns ± 3%  -17.55%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH26-6    13.4ns ± 0%  10.6ns ± 3%  -21.18%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH27-6    15.1ns ± 0%  10.5ns ± 4%  -30.54%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH28-6    16.1ns ± 2%  10.2ns ± 3%  -36.54%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH29-6    17.5ns ± 6%  10.1ns ± 3%  -42.43%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH30-6    18.4ns ± 0%   9.8ns ± 3%  -46.68%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH31-6    19.7ns ± 1%   9.8ns ± 4%  -50.46%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH32-6    10.6ns ± 2%   8.4ns ± 2%  -21.06%  (p=0.008 n=5+5)
JumpdestOpAnalysis/JUMPDEST-6  38.9ns ± 5%  20.2ns ± 6%  -48.12%  (p=0.008 n=5+5)
JumpdestOpAnalysis/STOP-6      38.8ns ± 4%  20.0ns ± 3%  -48.50%  (p=0.008 n=5+5)

@holiman holiman force-pushed the faster_analysis branch from 3b8abe1 to 3f60d8b Aug 16, 2021
@holiman
Copy link
Contributor Author

@holiman holiman commented Aug 18, 2021

latest numbers on master vs PR:

name                           old time/op  new time/op  delta
JumpdestOpAnalysis/PUSH1-6     35.5ns ± 4%  31.0ns ± 3%  -12.47%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH2-6     35.4ns ± 2%  27.5ns ± 0%  -22.33%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH3-6     37.8ns ± 4%  22.8ns ± 1%  -39.74%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH4-6     37.3ns ± 0%  18.0ns ±10%  -51.80%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH5-6     43.3ns ± 6%  16.2ns ± 4%  -62.64%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH6-6     42.6ns ± 3%  14.2ns ± 4%  -66.75%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH7-6     43.6ns ± 5%  13.3ns ± 6%  -69.42%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH8-6     11.9ns ± 2%  13.6ns ± 1%  +14.76%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH9-6     14.4ns ± 5%  12.5ns ± 4%  -13.49%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH10-6    17.1ns ± 4%  14.2ns ± 3%  -17.09%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH11-6    19.5ns ± 1%  13.0ns ± 0%  -33.62%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH12-6    21.3ns ± 4%  11.8ns ± 4%  -44.39%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH13-6    22.6ns ± 0%  11.8ns ± 1%  -47.85%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH14-6    24.5ns ± 5%  11.0ns ± 1%  -55.21%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH15-6    25.5ns ± 0%  10.7ns ± 3%  -58.02%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH16-6    10.1ns ± 0%   8.2ns ± 3%  -18.62%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH17-6    11.9ns ± 1%   7.8ns ± 1%  -34.12%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH18-6    13.5ns ± 0%   8.9ns ± 4%  -33.97%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH19-6    15.2ns ± 4%   8.7ns ± 4%  -43.12%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH20-6    16.4ns ± 1%   8.4ns ± 0%  -49.09%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH21-6    17.7ns ± 2%   8.1ns ± 0%  -54.42%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH22-6    19.1ns ± 4%   8.0ns ± 4%  -58.00%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH23-6    20.1ns ± 5%   7.8ns ± 4%  -61.41%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH24-6    10.1ns ± 3%   7.7ns ± 0%  -23.08%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH25-6    11.1ns ± 3%   7.6ns ± 1%  -31.31%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH26-6    12.1ns ± 1%   8.1ns ± 1%  -32.75%  (p=0.016 n=4+5)
JumpdestOpAnalysis/PUSH27-6    13.3ns ± 1%   8.3ns ± 3%  -37.19%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH28-6    14.7ns ± 3%   7.7ns ± 0%  -47.94%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH29-6    15.4ns ± 5%   7.6ns ± 0%  -50.62%  (p=0.016 n=5+4)
JumpdestOpAnalysis/PUSH30-6    16.4ns ± 5%   7.6ns ± 1%  -53.82%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH31-6    17.4ns ± 5%   7.5ns ± 1%  -56.58%  (p=0.008 n=5+5)
JumpdestOpAnalysis/PUSH32-6    9.58ns ± 1%  6.42ns ± 1%  -32.94%  (p=0.029 n=4+4)
JumpdestOpAnalysis/JUMPDEST-6  35.0ns ± 2%  20.2ns ± 5%  -42.29%  (p=0.008 n=5+5)
JumpdestOpAnalysis/STOP-6      34.7ns ± 0%  19.9ns ± 4%  -42.53%  (p=0.016 n=4+5)

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

LGTM

@karalabe karalabe added this to the 1.10.8 milestone Aug 24, 2021
@karalabe karalabe merged commit 1d99573 into ethereum:master Aug 24, 2021
0 of 2 checks passed
Copy link
Contributor

@chfast chfast left a comment

Why not having bitmap of only valid JUMPDESTs?

sidhujag added a commit to sidhujag/go-ethereum that referenced this issue Aug 24, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Aug 25, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Aug 25, 2021
uprendis added a commit to uprendis/go-ethereum that referenced this issue Aug 27, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
uprendis added a commit to uprendis/go-ethereum that referenced this issue Aug 27, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
uprendis added a commit to uprendis/go-ethereum that referenced this issue Aug 27, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
reds pushed a commit to reds/go-ethereum that referenced this issue Aug 28, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
i-norden added a commit to vulcanize/go-ethereum that referenced this issue Sep 10, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
atif-konasl added a commit to lukso-network/pandora-execution-engine that referenced this issue Oct 15, 2021
* core/vm: more detailed benchmark for jumpdest analysis

* core/vm: make jd analysis benchmark alloc free

* core/vm: improve jumpdest analysis

* core/vm: improve worst-case

* core/vm: further improvements in analysis

* core/vm: improve jumpdest analysis >PUSH15

* core/vm: make jd analysis ref by value

* core/vm: fix misspell

* core/vm: improve set8 and set16 a bit

* core/vm: reduce amount of code

* core/vm: optimize byte copying
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants