Skip to content

Conversation

@fjl
Copy link
Contributor

@fjl fjl commented Sep 10, 2025

This changes the modexp precompile to use a fork of math/big with some patches by @GottfriedHerold to improve worst-case performance.

@fjl fjl marked this pull request as ready for review September 11, 2025 10:22
@fjl fjl requested a review from rjl493456442 as a code owner September 11, 2025 10:22
@fjl fjl force-pushed the core-vm-modexpfix branch from 7094bcf to ced1ad0 Compare September 11, 2025 11:07
@fjl fjl added this to the 1.16.4 milestone Sep 11, 2025
@fjl
Copy link
Contributor Author

fjl commented Sep 11, 2025

Results are interesting:

                                                            │ modexp.old.txt │             modexp.new.txt             │
                                                            │     mgas/s     │    mgas/s     vs base                  │
PrecompiledModExp/nagydani-5-pow0x10001-Gas=285900-8            1109.0 ± ∞ ¹    619.9 ± ∞ ¹   -44.10% (p=0.008 n=5)
PrecompiledModExpEip2565/nagydani-5-pow0x10001-Gas=87381-8       338.9 ± ∞ ¹    189.5 ± ∞ ¹   -44.08% (p=0.008 n=5)
PrecompiledModExp/nagydani-4-pow0x10001-Gas=89292-8             1105.0 ± ∞ ¹    764.4 ± ∞ ¹   -30.82% (p=0.008 n=5)
PrecompiledModExpEip2565/nagydani-4-pow0x10001-Gas=21845-8       269.8 ± ∞ ¹    186.9 ± ∞ ¹   -30.73% (p=0.008 n=5)
PrecompiledModExpEip2565/nagydani-3-pow0x10001-Gas=5461-8        209.8 ± ∞ ¹    178.6 ± ∞ ¹   -14.87% (p=0.008 n=5)
PrecompiledModExp/nagydani-3-pow0x10001-Gas=30310-8             1166.0 ± ∞ ¹    993.9 ± ∞ ¹   -14.76% (p=0.008 n=5)
PrecompiledModExpEip2565/guido-2-even-Gas=2300-8                 34.84 ± ∞ ¹    35.57 ± ∞ ¹    +2.10% (p=0.008 n=5)
PrecompiledModExpEip2565/marcin-2-exp-heavy-Gas=852-8            34.25 ± ∞ ¹    35.07 ± ∞ ¹    +2.39% (p=0.008 n=5)
PrecompiledModExpEip2565/guido-1-even-Gas=2298-8                 60.06 ± ∞ ¹    62.50 ± ∞ ¹    +4.06% (p=0.008 n=5)
PrecompiledModExpEip2565/marius-1-even-Gas=2057-8                34.06 ± ∞ ¹    35.53 ± ∞ ¹    +4.32% (p=0.008 n=5)
PrecompiledModExpEip2565/marcin-3-base-heavy-Gas=677-8           45.73 ± ∞ ¹    47.86 ± ∞ ¹    +4.66% (p=0.008 n=5)
PrecompiledModExpEip2565/marcin-3-exp-heavy-Gas=765-8            43.78 ± ∞ ¹    46.23 ± ∞ ¹    +5.60% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-8-exp-896-Gas=298-8                 15.24 ± ∞ ¹    16.25 ± ∞ ¹    +6.63% (p=0.008 n=5)
PrecompiledModExpEip2565/pawel-1-exp-heavy-Gas=298-8             15.09 ± ∞ ¹    16.19 ± ∞ ¹    +7.29% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-32-exp-128-Gas=677-8                45.62 ± ∞ ¹    49.63 ± ∞ ¹    +8.79% (p=0.008 n=5)
PrecompiledModExp/nagydani-2-pow0x10001-Gas=10649-8              931.5 ± ∞ ¹   1031.0 ± ∞ ¹   +10.68% (p=0.008 n=5)
PrecompiledModExpEip2565/pawel-2-exp-heavy-Gas=425-8             30.07 ± ∞ ¹    33.39 ± ∞ ¹   +11.04% (p=0.008 n=5)
PrecompiledModExpEip2565/marcin-1-exp-heavy-Gas=215-8            14.56 ± ∞ ¹    16.17 ± ∞ ¹   +11.06% (p=0.008 n=5)
PrecompiledModExpEip2565/nagydani-2-pow0x10001-Gas=1365-8        119.6 ± ∞ ¹    133.8 ± ∞ ¹   +11.87% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-8-exp-648-Gas=215-8                 13.59 ± ∞ ¹    15.98 ± ∞ ¹   +17.59% (p=0.008 n=5)
PrecompiledModExpEip2565/nagydani-1-pow0x10001-Gas=341-8         66.55 ± ∞ ¹    78.84 ± ∞ ¹   +18.47% (p=0.008 n=5)
PrecompiledModExp/nagydani-1-pow0x10001-Gas=3276-8               640.4 ± ∞ ¹    762.0 ± ∞ ¹   +18.99% (p=0.008 n=5)
PrecompiledModExpEip2565/pawel-3-exp-heavy-Gas=501-8             34.04 ± ∞ ¹    43.87 ± ∞ ¹   +28.88% (p=0.008 n=5)
PrecompiledModExpEip2565/pawel-4-exp-heavy-Gas=506-8             33.59 ± ∞ ¹    48.20 ± ∞ ¹   +43.50% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-32-exp-32-Gas=200-8                 27.15 ± ∞ ¹    45.39 ± ∞ ¹   +67.18% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-32-exp-36-Gas=200-8                 24.31 ± ∞ ¹    41.19 ± ∞ ¹   +69.44% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-32-exp-40-Gas=208-8                 22.68 ± ∞ ¹    39.20 ± ∞ ¹   +72.84% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-32-exp-64-Gas=336-8                 23.00 ± ∞ ¹    42.05 ± ∞ ¹   +82.83% (p=0.008 n=5)
PrecompiledModExpEip2565/mod-32-exp-65-Gas=341-8                 22.99 ± ∞ ¹    42.96 ± ∞ ¹   +86.86% (p=0.008 n=5)
PrecompiledModExpEip2565/marcin-1-balanced-Gas=200-8             22.11 ± ∞ ¹    41.81 ± ∞ ¹   +89.10% (p=0.008 n=5)
PrecompiledModExpEip2565/marcin-2-balanced-Gas=996-8             29.59 ± ∞ ¹    59.32 ± ∞ ¹  +100.47% (p=0.008 n=5)
PrecompiledModExpEip2565/mod_vul_pawel_3_exp_8-Gas=200-8         12.59 ± ∞ ¹    38.01 ± ∞ ¹  +201.91% (p=0.008 n=5)

@MariusVanDerWijden
Copy link
Member

I have pushed it to the performance branch so we can see the difference in the performance grafana. I also built a fuzzer that has been fuzzing for a while to find both differences and big performance regressions. So far everything looks good

@chfast
Copy link
Member

chfast commented Sep 15, 2025

I can test this with my fuzzer too.

Copy link
Member

@MariusVanDerWijden MariusVanDerWijden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@MariusVanDerWijden MariusVanDerWijden merged commit 6a7f64e into ethereum:master Sep 16, 2025
6 of 8 checks passed
yperbasis added a commit to erigontech/erigon that referenced this pull request Sep 18, 2025
Cherry pick ethereum/go-ethereum#32576

BEFORE
```
goos: darwin
goarch: arm64
pkg: github.com/erigontech/erigon/core/vm
cpu: Apple M2 Max
BenchmarkPrecompiledModExpEip7883/eip_example1-Gas=4080-12         	   75729	     16444 ns/op	      4080 gas/op	       248.1 mgas/s	    2144 B/op	      27 allocs/op
BenchmarkPrecompiledModExpEip7883/eip_example2-Gas=4080-12         	12680174	        93.87 ns/op	      4080 gas/op	     43465 mgas/s	     160 B/op	       3 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-square-Gas=500-12     	 2373879	       501.7 ns/op	       500.0 gas/op	       996.6 mgas/s	     696 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-qube-Gas=500-12       	 1602600	       750.7 ns/op	       500.0 gas/op	       666.0 mgas/s	     984 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-12         	  228504	      4965 ns/op	      2048 gas/op	       412.4 mgas/s	    1480 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-square-Gas=512-12              	 1320512	       918.9 ns/op	       512.0 gas/op	       557.2 mgas/s	    1224 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-qube-Gas=512-12                	  714223	      1527 ns/op	       512.0 gas/op	       335.3 mgas/s	    1768 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-12         	  103635	     11486 ns/op	      8192 gas/op	       713.2 mgas/s	    2664 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-square-Gas=2048-12             	  545532	      1955 ns/op	      2048 gas/op	      1047 mgas/s	    2280 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-12               	  279217	      4026 ns/op	      2048 gas/op	       508.7 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-12        	   45536	     26570 ns/op	     32768 gas/op	      1233 mgas/s	    5224 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-square-Gas=8192-12             	  212790	      5417 ns/op	      8192 gas/op	      1512 mgas/s	    4552 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-12               	   97126	     12566 ns/op	      8192 gas/op	       651.9 mgas/s	   11595 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-12       	   14682	     81482 ns/op	    131072 gas/op	      1609 mgas/s	   15051 B/op	      12 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-square-Gas=32768-12            	   71446	     16877 ns/op	     32768 gas/op	      1941 mgas/s	    9230 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-12              	   30558	     38567 ns/op	     32768 gas/op	       849.6 mgas/s	   23188 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-12       	    4429	    265553 ns/op	    524288 gas/op	      1974 mgas/s	   32030 B/op	      28 allocs/op
BenchmarkPrecompiledModExpEip7883/marius-1-even-Gas=45296-12                	   26780	     44394 ns/op	     45296 gas/op	      1020 mgas/s	    1992 B/op	      40 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-1-even-Gas=51136-12                 	   41125	     28834 ns/op	     51136 gas/op	      1773 mgas/s	    1960 B/op	      43 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-2-even-Gas=51152-12                 	   23472	     50577 ns/op	     51152 gas/op	      1011 mgas/s	    2088 B/op	      41 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-3-even-Gas=32400-12                 	   86510	     13684 ns/op	     32400 gas/op	      2368 mgas/s	    8009 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-4-even-Gas=94448-12                 	 7207062	       165.4 ns/op	     94448 gas/op	    570947 mgas/s	     488 B/op	       6 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-12           	  412336	      2758 ns/op	      1152 gas/op	       417.7 mgas/s	    2568 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-12           	  106598	     11272 ns/op	     16624 gas/op	      1475 mgas/s	    1112 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-12             	  139212	      8523 ns/op	      1200 gas/op	       140.8 mgas/s	     840 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-12           	  132448	      8974 ns/op	      5202 gas/op	       579.6 mgas/s	    9322 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-12           	   64364	     18475 ns/op	     16368 gas/op	       885.9 mgas/s	    1536 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-12             	   41782	     28878 ns/op	      5978 gas/op	       207.0 mgas/s	    1576 B/op	      12 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-12           	  129862	      8876 ns/op	      2032 gas/op	       228.9 mgas/s	    2144 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-12            	  110368	     10622 ns/op	      4080 gas/op	       384.1 mgas/s	    1856 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-12             	   69883	     16505 ns/op	      4080 gas/op	       247.2 mgas/s	    2160 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-12                	   97918	     12297 ns/op	     16624 gas/op	      1352 mgas/s	    1336 B/op	      38 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-12                	   77826	     15248 ns/op	     24560 gas/op	      1611 mgas/s	    1352 B/op	      38 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-32-Gas=500-12                  	  155653	      7206 ns/op	       500.0 gas/op	        69.38 mgas/s	     728 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-36-Gas=560-12                  	  146266	      8080 ns/op	       560.0 gas/op	        69.30 mgas/s	     872 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-40-Gas=624-12                  	  134626	      8994 ns/op	       624.0 gas/op	        69.37 mgas/s	     728 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-12                 	   82645	     14400 ns/op	      1008 gas/op	        69.99 mgas/s	     728 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-12                 	  140695	      8480 ns/op	      1024 gas/op	       120.7 mgas/s	    2640 B/op	      41 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-12                	  137784	      8532 ns/op	      2032 gas/op	       238.2 mgas/s	    2640 B/op	      41 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-12                 	  276464	      4177 ns/op	      2048 gas/op	       490.2 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-12                 	  259459	      4383 ns/op	      2178 gas/op	       496.9 mgas/s	    3624 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-12               	   33732	     31730 ns/op	     32768 gas/op	      1033 mgas/s	   24212 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-12            	   78891	     15046 ns/op	     24560 gas/op	      1632 mgas/s	    1408 B/op	      40 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-12             	  105846	     11001 ns/op	      6128 gas/op	       557.0 mgas/s	    1928 B/op	      42 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-12             	  119985	      9480 ns/op	      2672 gas/op	       281.8 mgas/s	    2352 B/op	      42 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-12             	  134353	      8740 ns/op	      1520 gas/op	       173.9 mgas/s	    2648 B/op	      42 allocs/op
BenchmarkPrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-12         	   80396	     15129 ns/op	      1008 gas/op	        66.62 mgas/s	     608 B/op	       9 allocs/op
```

AFTER
```
goos: darwin
goarch: arm64
pkg: github.com/erigontech/erigon/core/vm
cpu: Apple M2 Max
BenchmarkPrecompiledModExpEip7883/eip_example1-Gas=4080-12         	   52860	     22778 ns/op	      4080 gas/op	       179.1 mgas/s	     496 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/eip_example2-Gas=4080-12         	12801109	        91.61 ns/op	      4080 gas/op	     44533 mgas/s	     160 B/op	       3 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-square-Gas=500-12     	 2422894	       487.8 ns/op	       500.0 gas/op	      1025 mgas/s	     696 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-qube-Gas=500-12       	 1609234	       741.7 ns/op	       500.0 gas/op	       674.1 mgas/s	     984 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-12         	  364200	      3284 ns/op	      2048 gas/op	       623.6 mgas/s	     936 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-square-Gas=512-12              	 1356390	       886.2 ns/op	       512.0 gas/op	       577.7 mgas/s	    1224 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-qube-Gas=512-12                	  719048	      1540 ns/op	       512.0 gas/op	       332.6 mgas/s	    1768 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-12         	  123076	      9663 ns/op	      8192 gas/op	       847.7 mgas/s	    1672 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-square-Gas=2048-12             	  552962	      1973 ns/op	      2048 gas/op	      1038 mgas/s	    2280 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-12               	  286252	      4043 ns/op	      2048 gas/op	       506.5 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-12        	   40658	     29910 ns/op	     32768 gas/op	      1096 mgas/s	    3112 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-square-Gas=8192-12             	  225214	      5273 ns/op	      8192 gas/op	      1553 mgas/s	    4553 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-12               	   99357	     12177 ns/op	      8192 gas/op	       672.7 mgas/s	    6985 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-12       	   10000	    115794 ns/op	    131072 gas/op	      1132 mgas/s	    6219 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-square-Gas=32768-12            	   73618	     15983 ns/op	     32768 gas/op	      2050 mgas/s	    9101 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-12              	   32450	     36631 ns/op	     32768 gas/op	       894.5 mgas/s	   13196 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-12       	    2623	    451022 ns/op	    524288 gas/op	      1162 mgas/s	   12447 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marius-1-even-Gas=45296-12                	   19376	     62163 ns/op	     45296 gas/op	       728.6 mgas/s	     592 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-1-even-Gas=51136-12                 	   35404	     33843 ns/op	     51136 gas/op	      1511 mgas/s	     680 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-2-even-Gas=51152-12                 	   17017	     69739 ns/op	     51152 gas/op	       733.4 mgas/s	     648 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-3-even-Gas=32400-12                 	  110955	     10649 ns/op	     32400 gas/op	      3042 mgas/s	    8009 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-4-even-Gas=94448-12                 	 7252432	       165.1 ns/op	     94448 gas/op	    572094 mgas/s	     488 B/op	       6 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-12           	  442668	      2629 ns/op	      1152 gas/op	       438.1 mgas/s	    2568 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-12           	  100824	     11898 ns/op	     16624 gas/op	      1397 mgas/s	     344 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-12             	  310458	      3887 ns/op	      1200 gas/op	       308.7 mgas/s	     712 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-12           	  132290	      9050 ns/op	      5202 gas/op	       574.8 mgas/s	    5225 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-12           	   45422	     25915 ns/op	     16368 gas/op	       631.6 mgas/s	     448 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-12             	   72652	     16630 ns/op	      5978 gas/op	       359.4 mgas/s	     888 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-12           	  100966	     11972 ns/op	      2032 gas/op	       169.7 mgas/s	     528 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-12            	   85906	     13942 ns/op	      4080 gas/op	       292.6 mgas/s	     496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-12             	   50563	     23756 ns/op	      4080 gas/op	       171.7 mgas/s	     544 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-12                	   96452	     12356 ns/op	     16624 gas/op	      1345 mgas/s	     352 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-12                	   70987	     16708 ns/op	     24560 gas/op	      1470 mgas/s	     368 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-32-Gas=500-12                  	  319215	      3796 ns/op	       500.0 gas/op	       131.7 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-36-Gas=560-12                  	  291817	      4096 ns/op	       560.0 gas/op	       136.7 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-40-Gas=624-12                  	  261309	      4475 ns/op	       624.0 gas/op	       139.4 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-12                 	  177766	      6670 ns/op	      1008 gas/op	       151.1 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-12                 	  178934	      6448 ns/op	      1024 gas/op	       158.8 mgas/s	     608 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-12                	  109399	     10844 ns/op	      2032 gas/op	       187.4 mgas/s	     608 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-12                 	  279650	      4236 ns/op	      2048 gas/op	       483.5 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-12                 	  269932	      4334 ns/op	      2178 gas/op	       502.5 mgas/s	    3624 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-12               	   40960	     28069 ns/op	     32768 gas/op	      1167 mgas/s	   14224 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-12            	   71101	     16897 ns/op	     24560 gas/op	      1453 mgas/s	     424 B/op	      12 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-12             	   88423	     13373 ns/op	      6128 gas/op	       458.2 mgas/s	     488 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-12             	  121406	      9772 ns/op	      2672 gas/op	       273.4 mgas/s	     576 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-12             	  138334	      8490 ns/op	      1520 gas/op	       179.0 mgas/s	     616 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-12         	  264200	      4392 ns/op	      1008 gas/op	       229.5 mgas/s	     496 B/op	      10 allocs/op
```

Note that though some cases become worse, the worst performance goes
from 66.62 mgas/s to 131.7 mgas/s.
Sahil-4555 pushed a commit to Sahil-4555/go-ethereum that referenced this pull request Oct 12, 2025
This changes the modexp precompile to use a fork of math/big with some
patches by @GottfriedHerold to improve worst-case performance.
NazariiDenha pushed a commit to erigontech/erigon that referenced this pull request Oct 24, 2025
Cherry pick ethereum/go-ethereum#32576

BEFORE
```
goos: darwin
goarch: arm64
pkg: github.com/erigontech/erigon/core/vm
cpu: Apple M2 Max
BenchmarkPrecompiledModExpEip7883/eip_example1-Gas=4080-12         	   75729	     16444 ns/op	      4080 gas/op	       248.1 mgas/s	    2144 B/op	      27 allocs/op
BenchmarkPrecompiledModExpEip7883/eip_example2-Gas=4080-12         	12680174	        93.87 ns/op	      4080 gas/op	     43465 mgas/s	     160 B/op	       3 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-square-Gas=500-12     	 2373879	       501.7 ns/op	       500.0 gas/op	       996.6 mgas/s	     696 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-qube-Gas=500-12       	 1602600	       750.7 ns/op	       500.0 gas/op	       666.0 mgas/s	     984 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-12         	  228504	      4965 ns/op	      2048 gas/op	       412.4 mgas/s	    1480 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-square-Gas=512-12              	 1320512	       918.9 ns/op	       512.0 gas/op	       557.2 mgas/s	    1224 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-qube-Gas=512-12                	  714223	      1527 ns/op	       512.0 gas/op	       335.3 mgas/s	    1768 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-12         	  103635	     11486 ns/op	      8192 gas/op	       713.2 mgas/s	    2664 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-square-Gas=2048-12             	  545532	      1955 ns/op	      2048 gas/op	      1047 mgas/s	    2280 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-12               	  279217	      4026 ns/op	      2048 gas/op	       508.7 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-12        	   45536	     26570 ns/op	     32768 gas/op	      1233 mgas/s	    5224 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-square-Gas=8192-12             	  212790	      5417 ns/op	      8192 gas/op	      1512 mgas/s	    4552 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-12               	   97126	     12566 ns/op	      8192 gas/op	       651.9 mgas/s	   11595 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-12       	   14682	     81482 ns/op	    131072 gas/op	      1609 mgas/s	   15051 B/op	      12 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-square-Gas=32768-12            	   71446	     16877 ns/op	     32768 gas/op	      1941 mgas/s	    9230 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-12              	   30558	     38567 ns/op	     32768 gas/op	       849.6 mgas/s	   23188 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-12       	    4429	    265553 ns/op	    524288 gas/op	      1974 mgas/s	   32030 B/op	      28 allocs/op
BenchmarkPrecompiledModExpEip7883/marius-1-even-Gas=45296-12                	   26780	     44394 ns/op	     45296 gas/op	      1020 mgas/s	    1992 B/op	      40 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-1-even-Gas=51136-12                 	   41125	     28834 ns/op	     51136 gas/op	      1773 mgas/s	    1960 B/op	      43 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-2-even-Gas=51152-12                 	   23472	     50577 ns/op	     51152 gas/op	      1011 mgas/s	    2088 B/op	      41 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-3-even-Gas=32400-12                 	   86510	     13684 ns/op	     32400 gas/op	      2368 mgas/s	    8009 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-4-even-Gas=94448-12                 	 7207062	       165.4 ns/op	     94448 gas/op	    570947 mgas/s	     488 B/op	       6 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-12           	  412336	      2758 ns/op	      1152 gas/op	       417.7 mgas/s	    2568 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-12           	  106598	     11272 ns/op	     16624 gas/op	      1475 mgas/s	    1112 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-12             	  139212	      8523 ns/op	      1200 gas/op	       140.8 mgas/s	     840 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-12           	  132448	      8974 ns/op	      5202 gas/op	       579.6 mgas/s	    9322 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-12           	   64364	     18475 ns/op	     16368 gas/op	       885.9 mgas/s	    1536 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-12             	   41782	     28878 ns/op	      5978 gas/op	       207.0 mgas/s	    1576 B/op	      12 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-12           	  129862	      8876 ns/op	      2032 gas/op	       228.9 mgas/s	    2144 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-12            	  110368	     10622 ns/op	      4080 gas/op	       384.1 mgas/s	    1856 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-12             	   69883	     16505 ns/op	      4080 gas/op	       247.2 mgas/s	    2160 B/op	      25 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-12                	   97918	     12297 ns/op	     16624 gas/op	      1352 mgas/s	    1336 B/op	      38 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-12                	   77826	     15248 ns/op	     24560 gas/op	      1611 mgas/s	    1352 B/op	      38 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-32-Gas=500-12                  	  155653	      7206 ns/op	       500.0 gas/op	        69.38 mgas/s	     728 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-36-Gas=560-12                  	  146266	      8080 ns/op	       560.0 gas/op	        69.30 mgas/s	     872 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-40-Gas=624-12                  	  134626	      8994 ns/op	       624.0 gas/op	        69.37 mgas/s	     728 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-12                 	   82645	     14400 ns/op	      1008 gas/op	        69.99 mgas/s	     728 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-12                 	  140695	      8480 ns/op	      1024 gas/op	       120.7 mgas/s	    2640 B/op	      41 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-12                	  137784	      8532 ns/op	      2032 gas/op	       238.2 mgas/s	    2640 B/op	      41 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-12                 	  276464	      4177 ns/op	      2048 gas/op	       490.2 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-12                 	  259459	      4383 ns/op	      2178 gas/op	       496.9 mgas/s	    3624 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-12               	   33732	     31730 ns/op	     32768 gas/op	      1033 mgas/s	   24212 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-12            	   78891	     15046 ns/op	     24560 gas/op	      1632 mgas/s	    1408 B/op	      40 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-12             	  105846	     11001 ns/op	      6128 gas/op	       557.0 mgas/s	    1928 B/op	      42 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-12             	  119985	      9480 ns/op	      2672 gas/op	       281.8 mgas/s	    2352 B/op	      42 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-12             	  134353	      8740 ns/op	      1520 gas/op	       173.9 mgas/s	    2648 B/op	      42 allocs/op
BenchmarkPrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-12         	   80396	     15129 ns/op	      1008 gas/op	        66.62 mgas/s	     608 B/op	       9 allocs/op
```

AFTER
```
goos: darwin
goarch: arm64
pkg: github.com/erigontech/erigon/core/vm
cpu: Apple M2 Max
BenchmarkPrecompiledModExpEip7883/eip_example1-Gas=4080-12         	   52860	     22778 ns/op	      4080 gas/op	       179.1 mgas/s	     496 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/eip_example2-Gas=4080-12         	12801109	        91.61 ns/op	      4080 gas/op	     44533 mgas/s	     160 B/op	       3 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-square-Gas=500-12     	 2422894	       487.8 ns/op	       500.0 gas/op	      1025 mgas/s	     696 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-qube-Gas=500-12       	 1609234	       741.7 ns/op	       500.0 gas/op	       674.1 mgas/s	     984 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-1-pow0x10001-Gas=2048-12         	  364200	      3284 ns/op	      2048 gas/op	       623.6 mgas/s	     936 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-square-Gas=512-12              	 1356390	       886.2 ns/op	       512.0 gas/op	       577.7 mgas/s	    1224 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-qube-Gas=512-12                	  719048	      1540 ns/op	       512.0 gas/op	       332.6 mgas/s	    1768 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-2-pow0x10001-Gas=8192-12         	  123076	      9663 ns/op	      8192 gas/op	       847.7 mgas/s	    1672 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-square-Gas=2048-12             	  552962	      1973 ns/op	      2048 gas/op	      1038 mgas/s	    2280 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-qube-Gas=2048-12               	  286252	      4043 ns/op	      2048 gas/op	       506.5 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-3-pow0x10001-Gas=32768-12        	   40658	     29910 ns/op	     32768 gas/op	      1096 mgas/s	    3112 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-square-Gas=8192-12             	  225214	      5273 ns/op	      8192 gas/op	      1553 mgas/s	    4553 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-qube-Gas=8192-12               	   99357	     12177 ns/op	      8192 gas/op	       672.7 mgas/s	    6985 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-4-pow0x10001-Gas=131072-12       	   10000	    115794 ns/op	    131072 gas/op	      1132 mgas/s	    6219 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-square-Gas=32768-12            	   73618	     15983 ns/op	     32768 gas/op	      2050 mgas/s	    9101 B/op	       7 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-qube-Gas=32768-12              	   32450	     36631 ns/op	     32768 gas/op	       894.5 mgas/s	   13196 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/nagydani-5-pow0x10001-Gas=524288-12       	    2623	    451022 ns/op	    524288 gas/op	      1162 mgas/s	   12447 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marius-1-even-Gas=45296-12                	   19376	     62163 ns/op	     45296 gas/op	       728.6 mgas/s	     592 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-1-even-Gas=51136-12                 	   35404	     33843 ns/op	     51136 gas/op	      1511 mgas/s	     680 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-2-even-Gas=51152-12                 	   17017	     69739 ns/op	     51152 gas/op	       733.4 mgas/s	     648 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-3-even-Gas=32400-12                 	  110955	     10649 ns/op	     32400 gas/op	      3042 mgas/s	    8009 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/guido-4-even-Gas=94448-12                 	 7252432	       165.1 ns/op	     94448 gas/op	    572094 mgas/s	     488 B/op	       6 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-base-heavy-Gas=1152-12           	  442668	      2629 ns/op	      1152 gas/op	       438.1 mgas/s	    2568 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-exp-heavy-Gas=16624-12           	  100824	     11898 ns/op	     16624 gas/op	      1397 mgas/s	     344 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-1-balanced-Gas=1200-12             	  310458	      3887 ns/op	      1200 gas/op	       308.7 mgas/s	     712 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-base-heavy-Gas=5202-12           	  132290	      9050 ns/op	      5202 gas/op	       574.8 mgas/s	    5225 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-exp-heavy-Gas=16368-12           	   45422	     25915 ns/op	     16368 gas/op	       631.6 mgas/s	     448 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-2-balanced-Gas=5978-12             	   72652	     16630 ns/op	      5978 gas/op	       359.4 mgas/s	     888 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-base-heavy-Gas=2032-12           	  100966	     11972 ns/op	      2032 gas/op	       169.7 mgas/s	     528 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-exp-heavy-Gas=4080-12            	   85906	     13942 ns/op	      4080 gas/op	       292.6 mgas/s	     496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/marcin-3-balanced-Gas=4080-12             	   50563	     23756 ns/op	      4080 gas/op	       171.7 mgas/s	     544 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-648-Gas=16624-12                	   96452	     12356 ns/op	     16624 gas/op	      1345 mgas/s	     352 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-8-exp-896-Gas=24560-12                	   70987	     16708 ns/op	     24560 gas/op	      1470 mgas/s	     368 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-32-Gas=500-12                  	  319215	      3796 ns/op	       500.0 gas/op	       131.7 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-36-Gas=560-12                  	  291817	      4096 ns/op	       560.0 gas/op	       136.7 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-40-Gas=624-12                  	  261309	      4475 ns/op	       624.0 gas/op	       139.4 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-64-Gas=1008-12                 	  177766	      6670 ns/op	      1008 gas/op	       151.1 mgas/s	     568 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-65-Gas=1024-12                 	  178934	      6448 ns/op	      1024 gas/op	       158.8 mgas/s	     608 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-32-exp-128-Gas=2032-12                	  109399	     10844 ns/op	      2032 gas/op	       187.4 mgas/s	     608 B/op	      10 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-256-exp-2-Gas=2048-12                 	  279650	      4236 ns/op	      2048 gas/op	       483.5 mgas/s	    3496 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-264-exp-2-Gas=2178-12                 	  269932	      4334 ns/op	      2178 gas/op	       502.5 mgas/s	    3624 B/op	       8 allocs/op
BenchmarkPrecompiledModExpEip7883/mod-1024-exp-2-Gas=32768-12               	   40960	     28069 ns/op	     32768 gas/op	      1167 mgas/s	   14224 B/op	       9 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-1-exp-heavy-Gas=24560-12            	   71101	     16897 ns/op	     24560 gas/op	      1453 mgas/s	     424 B/op	      12 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-2-exp-heavy-Gas=6128-12             	   88423	     13373 ns/op	      6128 gas/op	       458.2 mgas/s	     488 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-3-exp-heavy-Gas=2672-12             	  121406	      9772 ns/op	      2672 gas/op	       273.4 mgas/s	     576 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/pawel-4-exp-heavy-Gas=1520-12             	  138334	      8490 ns/op	      1520 gas/op	       179.0 mgas/s	     616 B/op	      11 allocs/op
BenchmarkPrecompiledModExpEip7883/mod_vul_pawel_3_exp_8-Gas=1008-12         	  264200	      4392 ns/op	      1008 gas/op	       229.5 mgas/s	     496 B/op	      10 allocs/op
```

Note that though some cases become worse, the worst performance goes
from 66.62 mgas/s to 131.7 mgas/s.
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.

3 participants