Skip to content

Instantly share code, notes, and snippets.

@sweeneyde
Created January 18, 2022 21:40
Show Gist options
  • Save sweeneyde/c13681e7c2c2f086b9082b3e4cfd8137 to your computer and use it in GitHub Desktop.
Save sweeneyde/c13681e7c2c2f086b9082b3e4cfd8137 to your computer and use it in GitHub Desktop.
Benchmarks for CPython PR 30653
from pyperf import Runner
runner = Runner()
phi = (1 + 5**0.5)/2
p_list = [f"10**{2**i}" for i in range(2, 11)]
q_list = [round(phi ** (2**i)) for i in range(2,8)]
for p in p_list:
for q in q_list:
runner.timeit(
name=f"{p} % {q}",
setup=f"p={p};q={q}",
stmt="p % q",
)
exponent_list = [2, 10, 100, 1_000, 10_000, 100_000, 1_000_000]
for e in exponent_list:
for q in q_list + [None]:
for base in [2, 3, 103]:
runner.timeit(
name=f"pow({base}, {e}, {q})",
setup=f"base={base}; e={e}; q={q}",
stmt="pow(base, e, q)"
)
for p in p_list:
for q in q_list:
q10 = q**10
runner.timeit(
name=f"gcd({p}, {q10})",
setup=f"from math import gcd; p={p}; q10={q10}",
stmt="gcd(p, q10)"
)
Slower (50):
- 10**32 % 23725150497407: 91.3 ns +- 0.9 ns -> 99.2 ns +- 0.7 ns: 1.09x slower- 10**128 % 23725150497407: 242 ns +- 3 ns -> 261 ns +- 21 ns: 1.08x slower
- pow(103, 10000, 562882766124614029418692608): 1.57 us +- 0.02 us -> 1.69 us +- 0.07 us: 1.08x slower
- pow(3, 100000, 562882766124614029418692608): 1.70 us +- 0.06 us -> 1.81 us +- 0.01 us: 1.07x slower
- pow(3, 10000, 562882766124614029418692608): 1.23 us +- 0.02 us -> 1.30 us +- 0.01 us: 1.06x slower
- 10**64 % 562882766124614029418692608: 131 ns +- 1 ns -> 139 ns +- 2 ns: 1.06x slower
- pow(3, 10000, 23725150497407): 1.12 us +- 0.04 us -> 1.19 us +- 0.01 us: 1.06x slower
- pow(103, 100000, 562882766124614029418692608): 2.08 us +- 0.03 us -> 2.20 us +- 0.02 us: 1.06x slower
- pow(2, 100000, 562882766124614029418692608): 1.72 us +- 0.02 us -> 1.81 us +- 0.02 us: 1.05x slower
- pow(103, 1000000, 23725150497407): 2.11 us +- 0.02 us -> 2.22 us +- 0.01 us: 1.05x slower
- 10**16 % 23725150497407: 65.6 ns +- 0.7 ns -> 68.7 ns +- 0.7 ns: 1.05x slower- pow(103, 10000, 23725150497407): 1.43 us +- 0.02 us -> 1.48 us +- 0.01 us: 1.04x slower
- 10**64 % 23725150497407: 138 ns +- 2 ns -> 143 ns +- 1 ns: 1.04x slower
- pow(3, 100000, 23725150497407): 1.51 us +- 0.04 us -> 1.56 us +- 0.01 us: 1.04x slower
- 10**256 % 23725150497407: 459 ns +- 19 ns -> 474 ns +- 2 ns: 1.03x slower
- pow(3, 1000000, 23725150497407): 1.92 us +- 0.04 us -> 1.97 us +- 0.02 us: 1.03x slower
- pow(103, 1000, 23725150497407): 1.08 us +- 0.01 us -> 1.12 us +- 0.00 us: 1.03x slower
- gcd(10**1024, 52599132235830049): 2.09 us +- 0.01 us -> 2.15 us +- 0.01 us: 1.03x slower
- pow(103, 1000000, 562882766124614029418692608): 2.53 us +- 0.09 us -> 2.59 us +- 0.01 us: 1.02x slower
- pow(103, 100000, 23725150497407): 1.76 us +- 0.02 us -> 1.80 us +- 0.01 us: 1.02x slower
- 10**32 % 562882766124614029418692608: 69.9 ns +- 0.6 ns -> 71.5 ns +- 0.8 ns: 1.02x slower
- gcd(10**32, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 1.05 us +- 0.01 us -> 1.07 us +- 0.00 us: 1.02x slower
- gcd(10**256, 52599132235830049): 827 ns +- 4 ns -> 845 ns +- 8 ns: 1.02x slower
- pow(103, 1000, None): 8.23 us +- 0.18 us -> 8.39 us +- 0.10 us: 1.02x slower
- pow(3, 1000000, 562882766124614029418692608): 2.22 us +- 0.07 us -> 2.26 us +- 0.02 us: 1.02x slower
- pow(2, 1000000, 23725150497407): 1.77 us +- 0.03 us -> 1.80 us +- 0.02 us: 1.02x slower
- pow(103, 1000, 562882766124614029418692608): 1.20 us +- 0.02 us -> 1.22 us +- 0.01 us: 1.02x slower
- pow(3, 2, None): 41.2 ns +- 0.2 ns -> 41.8 ns +- 0.6 ns: 1.02x slower
- 10**4 % 4870847: 23.7 ns +- 0.2 ns -> 24.1 ns +- 0.2 ns: 1.01x slower
- pow(2, 1000000, 562882766124614029418692608): 2.06 us +- 0.05 us -> 2.09 us +- 0.02 us: 1.01x slower
- pow(3, 2, 7): 54.2 ns +- 0.2 ns -> 54.9 ns +- 0.3 ns: 1.01x slower
- pow(3, 1000, 23725150497407): 838 ns +- 9 ns -> 849 ns +- 9 ns: 1.01x slower
- 10**4 % 2207: 23.7 ns +- 0.2 ns -> 24.0 ns +- 0.2 ns: 1.01x slower
- gcd(10**16, 2741721461562512091474269399629249): 407 ns +- 4 ns -> 411 ns +- 3 ns: 1.01x slower
- pow(103, 100, 562882766124614029418692608): 580 ns +- 13 ns -> 586 ns +- 3 ns: 1.01x slower
- pow(3, 100000, None): 1.45 ms +- 0.02 ms -> 1.46 ms +- 0.01 ms: 1.01x slower
- gcd(10**128, 52599132235830049): 559 ns +- 6 ns -> 565 ns +- 2 ns: 1.01x slower
- gcd(10**16, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 737 ns +- 13 ns -> 744 ns +- 3 ns: 1.01x slower
- pow(3, 1000000, None): 58.1 ms +- 0.4 ms -> 58.6 ms +- 0.3 ms: 1.01x slower
- 10**8 % 4870847: 23.8 ns +- 0.2 ns -> 24.0 ns +- 0.2 ns: 1.01x slower
- pow(2, 100000, 23725150497407): 1.47 us +- 0.02 us -> 1.48 us +- 0.01 us: 1.01x slower
- gcd(10**128, 7517005707443609642010169024208133793874755329046541742752787666049): 2.00 us +- 0.03 us -> 2.02 us +- 0.01 us: 1.01x slower
- gcd(10**32, 52599132235830049): 471 ns +- 5 ns -> 475 ns +- 4 ns: 1.01x slower
- pow(3, 2, 23725150497407): 48.8 ns +- 0.3 ns -> 49.2 ns +- 0.4 ns: 1.01x slower
- pow(2, 2, None): 41.5 ns +- 0.4 ns -> 41.8 ns +- 0.2 ns: 1.01x slower
- pow(3, 2, 562882766124614029418692608): 48.9 ns +- 0.6 ns -> 49.2 ns +- 0.4 ns: 1.01x slower
- pow(3, 100, 562882766124614029418692608): 295 ns +- 3 ns -> 297 ns +- 1 ns: 1.01x slower
- pow(103, 10, 23725150497407): 175 ns +- 1 ns -> 176 ns +- 1 ns: 1.01x slower
- gcd(10**4, 282475249): 169 ns +- 0 ns -> 170 ns +- 1 ns: 1.00x slower
- pow(103, 1000000, None): 577 ms +- 2 ms -> 579 ms +- 1 ms: 1.00x slower
Faster (159):
- 10**16 % 47: 50.0 ns +- 0.5 ns -> 34.3 ns +- 0.3 ns: 1.46x faster
- 10**16 % 7: 49.9 ns +- 0.4 ns -> 34.3 ns +- 0.4 ns: 1.45x faster
- 10**32 % 4870847: 73.1 ns +- 0.4 ns -> 53.3 ns +- 0.5 ns: 1.37x faster
- 10**32 % 2207: 72.7 ns +- 0.5 ns -> 53.1 ns +- 0.4 ns: 1.37x faster
- 10**32 % 7: 69.4 ns +- 1.1 ns -> 51.1 ns +- 0.5 ns: 1.36x faster
- 10**32 % 47: 69.1 ns +- 0.5 ns -> 51.2 ns +- 0.4 ns: 1.35x faster
- 10**64 % 4870847: 114 ns +- 1 ns -> 87.7 ns +- 1.0 ns: 1.30x faster
- 10**64 % 2207: 114 ns +- 1 ns -> 87.7 ns +- 0.7 ns: 1.30x faster
- 10**16 % 2207: 52.2 ns +- 0.4 ns -> 40.3 ns +- 0.2 ns: 1.30x faster
- 10**16 % 4870847: 52.1 ns +- 0.4 ns -> 40.4 ns +- 0.4 ns: 1.29x faster
- 10**64 % 7: 110 ns +- 1 ns -> 86.2 ns +- 0.9 ns: 1.28x faster
- 10**64 % 47: 110 ns +- 1 ns -> 86.3 ns +- 1.3 ns: 1.27x faster
- 10**8 % 23725150497407: 22.0 ns +- 0.1 ns -> 17.3 ns +- 0.1 ns: 1.27x faster
- 10**16 % 562882766124614029418692608: 21.7 ns +- 0.1 ns -> 17.0 ns +- 0.1 ns: 1.27x faster
- pow(103, 1000, 4870847): 584 ns +- 16 ns -> 460 ns +- 4 ns: 1.27x faster
- 10**8 % 562882766124614029418692608: 22.1 ns +- 0.2 ns -> 17.4 ns +- 0.1 ns: 1.27x faster
- 10**4 % 23725150497407: 22.0 ns +- 0.1 ns -> 17.4 ns +- 0.1 ns: 1.27x faster
- 10**4 % 562882766124614029418692608: 22.0 ns +- 0.1 ns -> 17.4 ns +- 0.1 ns: 1.26x faster
- pow(103, 100000, 4870847): 965 ns +- 23 ns -> 766 ns +- 4 ns: 1.26x faster
- 10**128 % 2207: 189 ns +- 14 ns -> 151 ns +- 1 ns: 1.25x faster
- pow(3, 100000, 4870847): 897 ns +- 13 ns -> 719 ns +- 13 ns: 1.25x faster
- pow(2, 1000000, 4870847): 1.05 us +- 0.03 us -> 847 ns +- 8 ns: 1.24x faster
- pow(3, 1000000, 4870847): 1.06 us +- 0.02 us -> 858 ns +- 7 ns: 1.24x faster
- 10**128 % 4870847: 186 ns +- 2 ns -> 151 ns +- 1 ns: 1.23x faster
- pow(103, 1000000, 4870847): 1.11 us +- 0.02 us -> 904 ns +- 12 ns: 1.23x faster
- pow(103, 100, 4870847): 374 ns +- 5 ns -> 306 ns +- 2 ns: 1.22x faster
- 10**128 % 7: 182 ns +- 2 ns -> 149 ns +- 2 ns: 1.22x faster
- pow(2, 10000, 4870847): 676 ns +- 6 ns -> 554 ns +- 7 ns: 1.22x faster
- 10**128 % 47: 181 ns +- 2 ns -> 149 ns +- 1 ns: 1.22x faster
- pow(3, 1000, 4870847): 531 ns +- 6 ns -> 438 ns +- 13 ns: 1.21x faster
- pow(3, 10000, 4870847): 693 ns +- 10 ns -> 572 ns +- 16 ns: 1.21x faster
- pow(2, 100000, 4870847): 847 ns +- 31 ns -> 711 ns +- 7 ns: 1.19x faster
- 10**256 % 7: 324 ns +- 3 ns -> 272 ns +- 1 ns: 1.19x faster
- pow(103, 10000, 4870847): 745 ns +- 9 ns -> 631 ns +- 11 ns: 1.18x faster
- 10**256 % 47: 324 ns +- 3 ns -> 276 ns +- 5 ns: 1.18x faster
- 10**256 % 2207: 323 ns +- 4 ns -> 276 ns +- 7 ns: 1.17x faster
- 10**256 % 4870847: 328 ns +- 4 ns -> 281 ns +- 5 ns: 1.17x faster
- 10**512 % 4870847: 611 ns +- 4 ns -> 525 ns +- 3 ns: 1.16x faster
- pow(2, 1000, 4870847): 514 ns +- 20 ns -> 442 ns +- 6 ns: 1.16x faster
- 10**512 % 2207: 610 ns +- 2 ns -> 524 ns +- 2 ns: 1.16x faster
- 10**512 % 7: 608 ns +- 6 ns -> 523 ns +- 3 ns: 1.16x faster
- pow(3, 100, 4870847): 297 ns +- 5 ns -> 255 ns +- 6 ns: 1.16x faster
- 10**512 % 47: 606 ns +- 2 ns -> 523 ns +- 3 ns: 1.16x faster
- 10**1024 % 4870847: 1.19 us +- 0.00 us -> 1.03 us +- 0.00 us: 1.15x faster
- pow(2, 100, 4870847): 260 ns +- 5 ns -> 226 ns +- 2 ns: 1.15x faster
- 10**1024 % 47: 1.18 us +- 0.00 us -> 1.03 us +- 0.00 us: 1.15x faster
- gcd(10**4, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 398 ns +- 3 ns -> 347 ns +- 1 ns: 1.15x faster
- 10**1024 % 7: 1.18 us +- 0.00 us -> 1.03 us +- 0.01 us: 1.14x faster
- 10**1024 % 2207: 1.19 us +- 0.01 us -> 1.04 us +- 0.02 us: 1.14x faster
- gcd(10**4, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 255 ns +- 1 ns -> 223 ns +- 2 ns: 1.14x faster
- gcd(10**4, 7517005707443609642010169024208133793874755329046541742752787666049): 257 ns +- 11 ns -> 224 ns +- 1 ns: 1.14x faster
- gcd(10**1024, 282475249): 1.31 us +- 0.00 us -> 1.16 us +- 0.00 us: 1.13x faster
- gcd(10**8, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 462 ns +- 2 ns -> 411 ns +- 3 ns: 1.12x faster
- gcd(10**512, 282475249): 824 ns +- 5 ns -> 737 ns +- 1 ns: 1.12x faster
- gcd(10**4, 2741721461562512091474269399629249): 155 ns +- 1 ns -> 138 ns +- 4 ns: 1.12x faster
- pow(3, 1000000, 47): 546 ns +- 10 ns -> 488 ns +- 12 ns: 1.12x faster
- gcd(10**256, 282475249): 484 ns +- 2 ns -> 433 ns +- 1 ns: 1.12x faster
- pow(3, 1000, 2207): 372 ns +- 8 ns -> 333 ns +- 11 ns: 1.12x faster
- pow(103, 10, 4870847): 161 ns +- 1 ns -> 145 ns +- 1 ns: 1.11x faster
- gcd(10**8, 7517005707443609642010169024208133793874755329046541742752787666049): 260 ns +- 1 ns -> 236 ns +- 1 ns: 1.10x faster
- pow(103, 1000, 2207): 387 ns +- 11 ns -> 351 ns +- 4 ns: 1.10x faster
- gcd(10**8, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 386 ns +- 3 ns -> 351 ns +- 1 ns: 1.10x faster
- gcd(10**64, 282475249): 282 ns +- 2 ns -> 257 ns +- 1 ns: 1.10x faster
- pow(103, 10000, 2207): 474 ns +- 9 ns -> 435 ns +- 4 ns: 1.09x faster
- pow(3, 100000, 2207): 558 ns +- 17 ns -> 512 ns +- 25 ns: 1.09x faster
- gcd(10**128, 282475249): 406 ns +- 2 ns -> 373 ns +- 1 ns: 1.09x faster
- pow(2, 1000000, 7): 512 ns +- 16 ns -> 475 ns +- 1 ns: 1.08x faster
- pow(103, 100000, 2207): 583 ns +- 15 ns -> 541 ns +- 18 ns: 1.08x faster
- gcd(10**8, 2741721461562512091474269399629249): 263 ns +- 1 ns -> 244 ns +- 1 ns: 1.08x faster
- pow(103, 1000000, 47): 573 ns +- 22 ns -> 532 ns +- 25 ns: 1.08x faster
- pow(3, 100000, 47): 448 ns +- 14 ns -> 416 ns +- 13 ns: 1.08x faster
- pow(103, 10000, 7): 369 ns +- 5 ns -> 345 ns +- 3 ns: 1.07x faster
- gcd(10**32, 282475249): 273 ns +- 1 ns -> 255 ns +- 1 ns: 1.07x faster
- pow(103, 1000000, 2207): 692 ns +- 28 ns -> 649 ns +- 29 ns: 1.07x faster
- pow(3, 100, 2207): 216 ns +- 6 ns -> 203 ns +- 6 ns: 1.06x faster
- pow(103, 10, 47): 124 ns +- 3 ns -> 117 ns +- 1 ns: 1.06x faster
- pow(2, 1000, 47): 307 ns +- 11 ns -> 289 ns +- 5 ns: 1.06x faster
- pow(2, 100000, 47): 456 ns +- 24 ns -> 429 ns +- 11 ns: 1.06x faster
- pow(2, 100, 2207): 210 ns +- 4 ns -> 197 ns +- 8 ns: 1.06x faster
- pow(3, 10000, 2207): 438 ns +- 10 ns -> 413 ns +- 4 ns: 1.06x faster
- pow(103, 100000, 7): 432 ns +- 2 ns -> 408 ns +- 4 ns: 1.06x faster
- pow(2, 100000, 7): 425 ns +- 10 ns -> 401 ns +- 2 ns: 1.06x faster
- pow(103, 10, 562882766124614029418692608): 128 ns +- 5 ns -> 121 ns +- 1 ns: 1.06x faster
- pow(2, 10000, 7): 351 ns +- 9 ns -> 332 ns +- 1 ns: 1.06x faster
- gcd(10**512, 2741721461562512091474269399629249): 1.88 us +- 0.05 us -> 1.78 us +- 0.01 us: 1.06x faster
- 10**512 % 562882766124614029418692608: 996 ns +- 44 ns -> 942 ns +- 5 ns: 1.06x faster
- gcd(10**256, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 6.29 us +- 0.18 us -> 5.98 us +- 0.04 us: 1.05x faster
- gcd(10**1024, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 10.00 us +- 0.29 us -> 9.51 us +- 0.04 us: 1.05x faster
- pow(103, 100000, None): 15.3 ms +- 1.1 ms -> 14.6 ms +- 0.1 ms: 1.05x faster
- gcd(10**1024, 2741721461562512091474269399629249): 2.82 us +- 0.13 us -> 2.69 us +- 0.01 us: 1.05x faster
- pow(3, 10, 23725150497407): 89.7 ns +- 1.9 ns -> 85.5 ns +- 2.2 ns: 1.05x faster
- gcd(10**512, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 7.34 us +- 0.13 us -> 7.00 us +- 0.04 us: 1.05x faster
- pow(3, 1000000, 7): 498 ns +- 3 ns -> 475 ns +- 4 ns: 1.05x faster
- pow(3, 100000, 7): 420 ns +- 1 ns -> 401 ns +- 2 ns: 1.05x faster
- pow(2, 10, 23725150497407): 89.4 ns +- 2.0 ns -> 85.5 ns +- 1.8 ns: 1.05x faster
- pow(103, 100000, 47): 479 ns +- 15 ns -> 458 ns +- 20 ns: 1.05x faster
- pow(3, 10, 562882766124614029418692608): 89.4 ns +- 2.4 ns -> 85.6 ns +- 2.1 ns: 1.04x faster
- pow(3, 1000, 7): 290 ns +- 1 ns -> 278 ns +- 2 ns: 1.04x faster
- pow(103, 1000, 7): 301 ns +- 4 ns -> 288 ns +- 2 ns: 1.04x faster
- pow(2, 100, 562882766124614029418692608): 226 ns +- 3 ns -> 216 ns +- 1 ns: 1.04x faster
- pow(2, 1000, 23725150497407): 673 ns +- 15 ns -> 646 ns +- 5 ns: 1.04x faster- gcd(10**512, 7517005707443609642010169024208133793874755329046541742752787666049): 3.13 us +- 0.07 us -> 3.01 us +- 0.01 us: 1.04x faster
- pow(3, 10000, 7): 346 ns +- 1 ns -> 333 ns +- 3 ns: 1.04x faster
- pow(103, 1000, 47): 313 ns +- 7 ns -> 301 ns +- 5 ns: 1.04x faster
- gcd(10**512, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 5.31 us +- 0.07 us -> 5.12 us +- 0.03 us: 1.04x faster
- pow(2, 1000, 7): 289 ns +- 1 ns -> 279 ns +- 2 ns: 1.04x faster
- pow(2, 10000, 47): 365 ns +- 9 ns -> 353 ns +- 8 ns: 1.04x faster
- pow(103, 10, None): 96.0 ns +- 1.0 ns -> 92.7 ns +- 0.6 ns: 1.04x faster
- pow(3, 100, 7): 181 ns +- 1 ns -> 175 ns +- 2 ns: 1.03x faster
- pow(103, 100, 7): 186 ns +- 1 ns -> 180 ns +- 2 ns: 1.03x faster
- pow(2, 10000, 2207): 429 ns +- 9 ns -> 417 ns +- 3 ns: 1.03x faster
- pow(3, 10000, 47): 349 ns +- 14 ns -> 338 ns +- 5 ns: 1.03x faster
- pow(2, 10, 562882766124614029418692608): 88.7 ns +- 1.9 ns -> 86.2 ns +- 1.6 ns: 1.03x faster
- 10**512 % 23725150497407: 947 ns +- 43 ns -> 921 ns +- 4 ns: 1.03x faster
- pow(2, 10000, None): 12.6 us +- 0.2 us -> 12.3 us +- 0.1 us: 1.03x faster
- pow(2, 1000000, 2207): 624 ns +- 19 ns -> 607 ns +- 27 ns: 1.03x faster
- pow(103, 1000000, 7): 514 ns +- 11 ns -> 500 ns +- 6 ns: 1.03x faster
- pow(103, 2, 7): 61.1 ns +- 0.4 ns -> 59.5 ns +- 0.6 ns: 1.03x faster
- pow(103, 100, 2207): 238 ns +- 11 ns -> 232 ns +- 5 ns: 1.03x faster
- gcd(10**256, 7517005707443609642010169024208133793874755329046541742752787666049): 2.42 us +- 0.03 us -> 2.36 us +- 0.01 us: 1.03x faster
- pow(2, 100, 7): 181 ns +- 1 ns -> 176 ns +- 2 ns: 1.03x faster
- pow(3, 10, 47): 108 ns +- 1 ns -> 105 ns +- 1 ns: 1.02x faster
- pow(103, 100, 47): 201 ns +- 3 ns -> 196 ns +- 4 ns: 1.02x faster
- pow(103, 10, 7): 112 ns +- 2 ns -> 110 ns +- 2 ns: 1.02x faster
- pow(3, 100, 47): 189 ns +- 3 ns -> 185 ns +- 5 ns: 1.02x faster
- gcd(10**32, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 1.21 us +- 0.01 us -> 1.18 us +- 0.01 us: 1.02x faster
- pow(3, 10, 2207): 112 ns +- 3 ns -> 110 ns +- 1 ns: 1.02x faster
- pow(2, 10, 7): 108 ns +- 1 ns -> 106 ns +- 1 ns: 1.02x faster
- 10**4 % 7: 18.7 ns +- 0.5 ns -> 18.3 ns +- 0.2 ns: 1.02x faster
- gcd(10**64, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 2.18 us +- 0.03 us -> 2.13 us +- 0.01 us: 1.02x faster
- pow(2, 100, 47): 185 ns +- 4 ns -> 181 ns +- 2 ns: 1.02x faster
- pow(103, 2, 47): 60.5 ns +- 0.8 ns -> 59.3 ns +- 0.2 ns: 1.02x faster
- pow(2, 1000, None): 474 ns +- 10 ns -> 465 ns +- 10 ns: 1.02x faster
- 10**8 % 47: 18.7 ns +- 0.5 ns -> 18.4 ns +- 0.4 ns: 1.02x faster
- pow(2, 100000, 2207): 516 ns +- 9 ns -> 507 ns +- 8 ns: 1.02x faster
- pow(3, 10, 7): 108 ns +- 1 ns -> 106 ns +- 1 ns: 1.02x faster
- pow(2, 10, None): 56.7 ns +- 0.7 ns -> 55.8 ns +- 0.9 ns: 1.02x faster
- pow(2, 10, 2207): 111 ns +- 1 ns -> 109 ns +- 1 ns: 1.02x faster
- pow(2, 10000, 562882766124614029418692608): 1.13 us +- 0.03 us -> 1.11 us +- 0.01 us: 1.02x faster
- pow(3, 10, None): 57.0 ns +- 0.9 ns -> 56.2 ns +- 1.2 ns: 1.01x faster
- pow(2, 100, None): 111 ns +- 1 ns -> 109 ns +- 2 ns: 1.01x faster
- gcd(10**256, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 4.34 us +- 0.12 us -> 4.28 us +- 0.02 us: 1.01x faster
- gcd(10**128, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824): 3.39 us +- 0.08 us -> 3.34 us +- 0.01 us: 1.01x faster
- pow(2, 10, 47): 109 ns +- 1 ns -> 108 ns +- 1 ns: 1.01x faster
- pow(103, 100, 23725150497407): 562 ns +- 11 ns -> 555 ns +- 4 ns: 1.01x faster
- gcd(10**256, 2741721461562512091474269399629249): 1.56 us +- 0.01 us -> 1.54 us +- 0.01 us: 1.01x faster
- gcd(10**1024, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249): 7.00 us +- 0.16 us -> 6.91 us +- 0.03 us: 1.01x faster
- 10**4 % 47: 18.5 ns +- 0.2 ns -> 18.2 ns +- 0.1 ns: 1.01x faster
- pow(103, 2, 2207): 65.1 ns +- 0.7 ns -> 64.3 ns +- 0.6 ns: 1.01x faster
- gcd(10**16, 7517005707443609642010169024208133793874755329046541742752787666049): 480 ns +- 2 ns -> 476 ns +- 2 ns: 1.01x faster
- pow(3, 1000, 47): 286 ns +- 2 ns -> 283 ns +- 2 ns: 1.01x faster
- pow(2, 10, 4870847): 110 ns +- 1 ns -> 109 ns +- 1 ns: 1.01x faster
- pow(2, 100, 23725150497407): 283 ns +- 4 ns -> 281 ns +- 2 ns: 1.01x faster
- pow(2, 1000000, None): 2.76 ms +- 0.01 ms -> 2.74 ms +- 0.01 ms: 1.01x faster- pow(103, 2, 23725150497407): 57.0 ns +- 0.6 ns -> 56.6 ns +- 0.4 ns: 1.01x faster
- gcd(10**64, 2741721461562512091474269399629249): 947 ns +- 9 ns -> 941 ns +- 4 ns: 1.01x faster
- pow(103, 2, None): 48.8 ns +- 0.3 ns -> 48.5 ns +- 0.4 ns: 1.01x faster
- gcd(10**8, 52599132235830049): 280 ns +- 2 ns -> 279 ns +- 1 ns: 1.00x faster- gcd(10**16, 282475249): 280 ns +- 1 ns -> 279 ns +- 1 ns: 1.00x faster
Benchmark hidden because not significant (46): 10**8 % 7, 10**8 % 2207, 10**128 % 562882766124614029418692608, 10**256 % 562882766124614029418692608, 10**1024 % 23725150497407, 10**1024 % 562882766124614029418692608, pow(2, 2, 7), pow(2, 2, 47), pow(3, 2, 47), pow(2, 2, 2207), pow(3, 2, 2207), pow(2, 2, 4870847), pow(3, 2, 4870847), pow(103, 2, 4870847), pow(2, 2, 23725150497407), pow(2, 2, 562882766124614029418692608), pow(103, 2, 562882766124614029418692608), pow(103, 10, 2207), pow(3, 10, 4870847), pow(3, 100, 23725150497407), pow(3, 100, None), pow(103, 100, None), pow(2, 1000, 2207), pow(2, 1000, 562882766124614029418692608), pow(3, 1000, 562882766124614029418692608), pow(3, 1000, None), pow(103, 10000, 47), pow(2, 10000, 23725150497407), pow(3, 10000, None), pow(103, 10000, None), pow(2, 100000, None), pow(2, 1000000, 47), pow(3, 1000000, 2207), gcd(10**4, 52599132235830049), gcd(10**8, 282475249), gcd(10**16, 52599132235830049), gcd(10**16, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824), gcd(10**32, 2741721461562512091474269399629249), gcd(10**32, 7517005707443609642010169024208133793874755329046541742752787666049), gcd(10**64, 52599132235830049), gcd(10**64, 7517005707443609642010169024208133793874755329046541742752787666049), gcd(10**64, 3192857381931888018672984330686275629558542939896002580209874607283939406524559498132575703439799822498449909412218266456530446200324372514883069010515730835987525698012022760748971252290712126457385060371557996584728311581898610292570603235873833046610693302805069824), gcd(10**128, 2741721461562512091474269399629249), gcd(10**128, 56505374805692168958528669193030172859110697704434622218780822905222924446017120144594436607279663108434060980061722351480616927893249), gcd(10**512, 52599132235830049), gcd(10**1024, 7517005707443609642010169024208133793874755329046541742752787666049)
Geometric mean: 1.06x faster
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment