Skip to content

Instantly share code, notes, and snippets.

@wanderer
Created February 23, 2015 23:42
Show Gist options
  • Save wanderer/5aab77502625d6e2e1d5 to your computer and use it in GitHub Desktop.
Save wanderer/5aab77502625d6e2e1d5 to your computer and use it in GitHub Desktop.
Benchmarking: create-10
bn.js#create-10 x 1,135,003 ops/sec ±2.69% (9 runs sampled)
bignum#create-10 x 343,963 ops/sec ±2.56% (7 runs sampled)
bigi#create-10 x 823,703 ops/sec ±1.69% (9 runs sampled)
yaffle#create-10 x 1,355,594 ops/sec ±3.45% (9 runs sampled)
silentmatt-biginteger#create-10 x 92,834 ops/sec ±5.38% (9 runs sampled)
crunch#create-10 x 14,685 ops/sec ±8.53% (7 runs sampled)
------------------------
Fastest is yaffle#create-10
========================
Benchmarking: create-hex
bn.js#create-hex x 1,619,584 ops/sec ±2.46% (9 runs sampled)
bignum#create-hex x 283,541 ops/sec ±6.69% (9 runs sampled)
bigi#create-hex x 812,707 ops/sec ±2.24% (9 runs sampled)
sjcl#create-hex x 947,148 ops/sec ±5.32% (9 runs sampled)
yaffle#create-hex x 1,129,774 ops/sec ±2.84% (9 runs sampled)
silentmatt-biginteger#create-hex x 20,382 ops/sec ±2.74% (7 runs sampled)
------------------------
Fastest is bn.js#create-hex
========================
Benchmarking: toString-10
bn.js#toString-10 x 610,007 ops/sec ±2.84% (9 runs sampled)
bignum#toString-10 x 682,255 ops/sec ±1.22% (9 runs sampled)
bigi#toString-10 x 100,820 ops/sec ±3.02% (9 runs sampled)
yaffle#toString-10 x 1,422,903 ops/sec ±2.61% (8 runs sampled)
silentmatt-biginteger#toString-10 x 4,164,332 ops/sec ±5.83% (9 runs sampled)
crunch#toString-10 x 2,742 ops/sec ±4.40% (7 runs sampled)
------------------------
Fastest is silentmatt-biginteger#toString-10
========================
Benchmarking: toString-hex
bn.js#toString-hex x 594,141 ops/sec ±2.73% (9 runs sampled)
bignum#toString-hex x 3,269,701 ops/sec ±2.81% (9 runs sampled)
bigi#toString-hex x 727,974 ops/sec ±5.20% (7 runs sampled)
sjcl#toString-hex x 585,400 ops/sec ±3.50% (9 runs sampled)
yaffle#toString-hex x 503,664 ops/sec ±3.46% (9 runs sampled)
silentmatt-biginteger#toString-hex x 14,177 ops/sec ±10.74% (8 runs sampled)
------------------------
Fastest is bignum#toString-hex
========================
Benchmarking: add
bn.js#add x 5,245,444 ops/sec ±9.61% (8 runs sampled)
bignum#add x 556,575 ops/sec ±4.79% (8 runs sampled)
bigi#add x 3,032,625 ops/sec ±2.86% (8 runs sampled)
sjcl#add x 3,626,789 ops/sec ±1.40% (9 runs sampled)
yaffle#add x 7,531,329 ops/sec ±1.96% (9 runs sampled)
silentmatt-biginteger#add x 1,602,826 ops/sec ±2.31% (9 runs sampled)
crunch#add x 175,082 ops/sec ±2.37% (9 runs sampled)
------------------------
Fastest is yaffle#add
========================
Benchmarking: sub
bn.js#sub x 7,245,108 ops/sec ±1.98% (9 runs sampled)
bignum#sub x 552,844 ops/sec ±2.08% (9 runs sampled)
bigi#sub x 2,689,666 ops/sec ±1.33% (9 runs sampled)
sjcl#sub x 3,451,874 ops/sec ±6.02% (9 runs sampled)
yaffle#sub x 7,153,766 ops/sec ±2.25% (9 runs sampled)
silentmatt-biginteger#sub x 8,129,604 ops/sec ±4.76% (9 runs sampled)
crunch#sub x 149,830 ops/sec ±7.13% (9 runs sampled)
------------------------
Fastest is silentmatt-biginteger#sub
========================
Benchmarking: mul
bn.js#mul x 1,773,500 ops/sec ±2.21% (8 runs sampled)
bignum#mul x 430,362 ops/sec ±3.80% (9 runs sampled)
bigi#mul x 700,509 ops/sec ±3.13% (9 runs sampled)
sjcl#mul x 2,516,888 ops/sec ±1.94% (9 runs sampled)
yaffle#mul x 866,753 ops/sec ±1.72% (8 runs sampled)
silentmatt-biginteger#mul x 631,173 ops/sec ±1.29% (9 runs sampled)
crunch#mul x 151,528 ops/sec ±2.91% (8 runs sampled)
------------------------
Fastest is sjcl#mul
========================
Benchmarking: sqr
bn.js#sqr x 1,776,619 ops/sec ±0.63% (9 runs sampled)
bignum#sqr x 468,955 ops/sec ±0.61% (9 runs sampled)
bigi#sqr x 435,707 ops/sec ±1.11% (9 runs sampled)
sjcl#sqr x 2,275,132 ops/sec ±0.30% (8 runs sampled)
yaffle#sqr x 887,505 ops/sec ±1.99% (9 runs sampled)
silentmatt-biginteger#sqr x 533,986 ops/sec ±1.19% (9 runs sampled)
crunch#sqr x 184,985 ops/sec ±1.93% (9 runs sampled)
------------------------
Fastest is sjcl#sqr
========================
Benchmarking: div
bn.js#div x 395,222 ops/sec ±1.88% (8 runs sampled)
bignum#div x 330,449 ops/sec ±0.38% (9 runs sampled)
bigi#div x 213,266 ops/sec ±1.53% (9 runs sampled)
yaffle#div x 471,640 ops/sec ±1.28% (9 runs sampled)
silentmatt-biginteger#div x 25,216 ops/sec ±1.82% (7 runs sampled)
crunch#div:
------------------------
Fastest is yaffle#div
========================
Benchmarking: mod
bn.js#mod x 381,539 ops/sec ±1.47% (8 runs sampled)
bignum#mod x 374,150 ops/sec ±2.98% (9 runs sampled)
bigi#mod x 202,103 ops/sec ±1.07% (9 runs sampled)
yaffle#mod x 408,589 ops/sec ±0.37% (9 runs sampled)
silentmatt-biginteger#mod x 22,012 ops/sec ±0.26% (9 runs sampled)
crunch#mod x 52,144 ops/sec ±1.43% (8 runs sampled)
------------------------
Fastest is yaffle#mod
========================
Benchmarking: mul-mod k256
bn.js#mul-mod k256 x 1,096,736 ops/sec ±0.66% (9 runs sampled)
sjcl#mul-mod k256 x 508,105 ops/sec ±1.11% (9 runs sampled)
------------------------
Fastest is bn.js#mul-mod k256
========================
Benchmarking: pow k256
bn.js#pow k256 x 1,612 ops/sec ±0.08% (9 runs sampled)
bignum#pow k256 x 43,569 ops/sec ±1.16% (7 runs sampled)
crunch#pow k256 x 932 ops/sec ±1.97% (8 runs sampled)
------------------------
Fastest is bignum#pow k256
========================
Benchmarking: invm k256
bn.js#invm k256 x 6,550 ops/sec ±0.09% (9 runs sampled)
sjcl#invm k256 x 5,202 ops/sec ±0.10% (7 runs sampled)
crunch#invm k256 x 1,384 ops/sec ±1.93% (9 runs sampled)
------------------------
Fastest is bn.js#invm k256
========================
Benchmarking: gcd
bn.js#gcd x 28,818 ops/sec ±1.89% (7 runs sampled)
bigi#gcd x 34,785 ops/sec ±0.49% (6 runs sampled)
------------------------
Fastest is bigi#gcd
========================
Benchmarking: egcd
bn.js#egcd x 7,081 ops/sec ±1.39% (9 runs sampled)
------------------------
Fastest is bn.js#egcd
========================
Benchmarking: bitLength
bn.js#bitLength x 45,113,269 ops/sec ±0.90% (9 runs sampled)
------------------------
Fastest is bn.js#bitLength
========================
null@archy ~/c/b/benchmarks> node ./index.js
Benchmarking: create-10
^Cfish: Job 1, “node ./index.js” terminated by signal SIGINT (Quit request from job control (^C))
null@archy ~/c/b/benchmarks> node ./index.js
Benchmarking: create-10
bn.js#create-10 x 1,172,453 ops/sec ±2.46% (9 runs sampled)
bignum#create-10 x 369,524 ops/sec ±3.90% (8 runs sampled)
bigi#create-10 x 818,436 ops/sec ±4.40% (9 runs sampled)
yaffle#create-10 x 1,395,338 ops/sec ±1.75% (8 runs sampled)
silentmatt-biginteger#create-10 x 95,642 ops/sec ±12.52% (9 runs sampled)
crunch#create-10 x 14,222 ops/sec ±12.67% (8 runs sampled)
------------------------
Fastest is yaffle#create-10
========================
Benchmarking: create-hex
bn.js#create-hex x 1,698,404 ops/sec ±3.86% (9 runs sampled)
bignum#create-hex x 365,868 ops/sec ±6.93% (9 runs sampled)
bigi#create-hex x 854,916 ops/sec ±1.61% (9 runs sampled)
sjcl#create-hex x 1,035,572 ops/sec ±2.97% (8 runs sampled)
yaffle#create-hex x 1,200,273 ops/sec ±1.25% (6 runs sampled)
silentmatt-biginteger#create-hex x 19,418 ops/sec ±3.88% (9 runs sampled)
------------------------
Fastest is bn.js#create-hex
========================
Benchmarking: toString-10
bn.js#toString-10 x 635,528 ops/sec ±4.60% (6 runs sampled)
bignum#toString-10 x 708,422 ops/sec ±0.67% (9 runs sampled)
bigi#toString-10 x 103,062 ops/sec ±0.85% (7 runs sampled)
yaffle#toString-10 x 1,459,622 ops/sec ±2.74% (9 runs sampled)
silentmatt-biginteger#toString-10 x 4,489,267 ops/sec ±4.11% (8 runs sampled)
crunch#toString-10 x 3,044 ops/sec ±1.51% (9 runs sampled)
------------------------
Fastest is silentmatt-biginteger#toString-10
========================
Benchmarking: toString-hex
bn.js#toString-hex x 621,730 ops/sec ±0.72% (9 runs sampled)
bignum#toString-hex x 3,086,469 ops/sec ±2.21% (9 runs sampled)
bigi#toString-hex x 844,973 ops/sec ±0.80% (9 runs sampled)
sjcl#toString-hex x 613,090 ops/sec ±3.18% (8 runs sampled)
yaffle#toString-hex x 531,309 ops/sec ±1.90% (8 runs sampled)
silentmatt-biginteger#toString-hex x 20,208 ops/sec ±1.76% (9 runs sampled)
------------------------
Fastest is bignum#toString-hex
========================
Benchmarking: add
bn.js#add x 6,526,189 ops/sec ±1.04% (9 runs sampled)
bignum#add x 641,022 ops/sec ±0.68% (9 runs sampled)
bigi#add x 3,284,322 ops/sec ±0.97% (8 runs sampled)
sjcl#add x 3,575,488 ops/sec ±4.43% (9 runs sampled)
yaffle#add x 7,789,342 ops/sec ±0.35% (9 runs sampled)
silentmatt-biginteger#add x 1,829,484 ops/sec ±1.79% (9 runs sampled)
crunch#add x 185,852 ops/sec ±0.97% (9 runs sampled)
------------------------
Fastest is yaffle#add
========================
Benchmarking: sub
bn.js#sub x 7,732,200 ops/sec ±1.72% (9 runs sampled)
bignum#sub x 614,322 ops/sec ±2.32% (9 runs sampled)
bigi#sub x 3,191,248 ops/sec ±1.50% (8 runs sampled)
sjcl#sub x 3,888,637 ops/sec ±0.76% (8 runs sampled)
yaffle#sub x 7,015,221 ops/sec ±1.91% (9 runs sampled)
silentmatt-biginteger#sub x 8,290,376 ops/sec ±2.41% (7 runs sampled)
crunch#sub x 177,152 ops/sec ±3.64% (9 runs sampled)
------------------------
Fastest is silentmatt-biginteger#sub
========================
Benchmarking: mul
bn.js#mul x 1,913,248 ops/sec ±1.33% (9 runs sampled)
bignum#mul x 463,909 ops/sec ±2.64% (9 runs sampled)
bigi#mul x 756,062 ops/sec ±0.74% (9 runs sampled)
sjcl#mul x 2,589,776 ops/sec ±2.43% (8 runs sampled)
yaffle#mul x 936,779 ops/sec ±2.71% (7 runs sampled)
silentmatt-biginteger#mul x 643,243 ops/sec ±2.59% (7 runs sampled)
crunch#mul x 165,648 ops/sec ±1.54% (9 runs sampled)
------------------------
Fastest is sjcl#mul
========================
Benchmarking: sqr
bn.js#sqr x 1,809,921 ops/sec ±2.56% (9 runs sampled)
bignum#sqr x 445,319 ops/sec ±2.88% (9 runs sampled)
bigi#sqr x 449,344 ops/sec ±0.60% (9 runs sampled)
sjcl#sqr x 2,213,426 ops/sec ±6.01% (9 runs sampled)
yaffle#sqr x 882,535 ops/sec ±3.82% (8 runs sampled)
silentmatt-biginteger#sqr x 497,356 ops/sec ±4.70% (9 runs sampled)
crunch#sqr x 188,493 ops/sec ±1.03% (9 runs sampled)
------------------------
Fastest is sjcl#sqr
========================
Benchmarking: div
bn.js#div x 396,264 ops/sec ±1.30% (7 runs sampled)
bignum#div x 334,664 ops/sec ±3.22% (9 runs sampled)
bigi#div x 213,198 ops/sec ±3.13% (9 runs sampled)
yaffle#div x 469,225 ops/sec ±1.52% (9 runs sampled)
silentmatt-biginteger#div x 25,307 ops/sec ±0.84% (8 runs sampled)
crunch#div x 54,223 ops/sec ±1.29% (9 runs sampled)
------------------------
Fastest is yaffle#div
========================
Benchmarking: mod
bn.js#mod x 382,105 ops/sec ±1.62% (8 runs sampled)
bignum#mod x 396,162 ops/sec ±3.22% (9 runs sampled)
bigi#mod x 205,895 ops/sec ±1.14% (9 runs sampled)
yaffle#mod x 392,018 ops/sec ±3.08% (8 runs sampled)
silentmatt-biginteger#mod x 21,331 ops/sec ±2.09% (9 runs sampled)
crunch#mod x 51,349 ops/sec ±1.74% (9 runs sampled)
------------------------
Fastest is bignum#mod,yaffle#mod
========================
Benchmarking: mul-mod k256
bn.js#mul-mod k256 x 1,062,365 ops/sec ±2.11% (9 runs sampled)
sjcl#mul-mod k256 x 488,829 ops/sec ±1.51% (9 runs sampled)
------------------------
Fastest is bn.js#mul-mod k256
========================
Benchmarking: pow k256
bn.js#pow k256 x 1,569 ops/sec ±2.70% (7 runs sampled)
bignum#pow k256 x 43,339 ops/sec ±2.79% (9 runs sampled)
crunch#pow k256 x 903 ops/sec ±6.55% (7 runs sampled)
------------------------
Fastest is bignum#pow k256
========================
Benchmarking: invm k256
bn.js#invm k256 x 6,121 ops/sec ±9.82% (8 runs sampled)
sjcl#invm k256 x 5,083 ops/sec ±2.98% (9 runs sampled)
crunch#invm k256 x 1,503 ops/sec ±3.34% (9 runs sampled)
------------------------
Fastest is bn.js#invm k256
========================
Benchmarking: gcd
bn.js#gcd x 27,333 ops/sec ±4.06% (7 runs sampled)
bigi#gcd x 34,472 ops/sec ±2.94% (9 runs sampled)
------------------------
Fastest is bigi#gcd
========================
Benchmarking: egcd
bn.js#egcd x 6,928 ops/sec ±1.01% (8 runs sampled)
------------------------
Fastest is bn.js#egcd
========================
Benchmarking: bitLength
bn.js#bitLength x 46,530,044 ops/sec ±2.63% (8 runs sampled)
------------------------
Fastest is bn.js#bitLength
========================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment