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

Benchmark for BigInt #226

Merged
merged 5 commits into from
Dec 22, 2019
Merged

Benchmark for BigInt #226

merged 5 commits into from
Dec 22, 2019

Conversation

fanatid
Copy link
Collaborator

@fanatid fanatid commented Aug 10, 2019

@mathiasbynens can you share benchmark which was used in article? https://v8.dev/features/bigint#use-cases

bn.js VS BigInt

$ node --version
v12.8.0
$ uname -r
5.1.20-300.fc30.x86_64
$ grep 'model name' -m 1 /proc/cpuinfo
model name	: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
$ SEED=d3010f0048b13a628169fc81a4c0318d node index.js 
Load bignum error: Cannot find module 'bignum'
Seed: d3010f0048b13a628169fc81a4c0318d
Benchmarking: create-10
bn.js#create-10 x 962,231 ops/sec ±1.13% (9 runs sampled)
BigInt#create-10 x 2,684,467 ops/sec ±0.72% (9 runs sampled)
------------------------
Fastest is BigInt#create-10
========================
Benchmarking: toString-10
bn.js#toString-10 x 466,028 ops/sec ±0.94% (9 runs sampled)
BigInt#toString-10 x 691,462 ops/sec ±0.41% (7 runs sampled)
------------------------
Fastest is BigInt#toString-10
========================
Benchmarking: toString-hex
bn.js#toString-hex x 274,852 ops/sec ±1.54% (8 runs sampled)
BigInt#toString-hex x 7,493,824 ops/sec ±1.60% (9 runs sampled)
------------------------
Fastest is BigInt#toString-hex
========================
Benchmarking: add
bn.js#add x 10,930,340 ops/sec ±0.88% (9 runs sampled)
BigInt#add x 10,876,360 ops/sec ±0.59% (9 runs sampled)
------------------------
Fastest is bn.js#add,BigInt#add
========================
Benchmarking: sub
bn.js#sub x 8,617,757 ops/sec ±1.47% (8 runs sampled)
BigInt#sub x 10,467,586 ops/sec ±0.76% (9 runs sampled)
------------------------
Fastest is BigInt#sub
========================
Benchmarking: mul
bn.js#mul x 3,649,547 ops/sec ±0.80% (8 runs sampled)
BigInt#mul x 5,113,954 ops/sec ±8.59% (8 runs sampled)
------------------------
Fastest is BigInt#mul
========================
Benchmarking: mul-jumbo
bn.js#mul-jumbo x 3,735 ops/sec ±0.59% (9 runs sampled)
BigInt#mul-jumbo x 22,364 ops/sec ±3.43% (8 runs sampled)
------------------------
Fastest is BigInt#mul-jumbo
========================
Benchmarking: sqr
bn.js#sqr x 3,667,287 ops/sec ±0.25% (8 runs sampled)
BigInt#sqr x 5,581,414 ops/sec ±1.21% (9 runs sampled)
------------------------
Fastest is BigInt#sqr
========================
Benchmarking: div
bn.js#div x 615,096 ops/sec ±0.69% (8 runs sampled)
BigInt#div x 2,321,200 ops/sec ±0.62% (9 runs sampled)
------------------------
Fastest is BigInt#div
========================
Benchmarking: mod
bn.js#mod x 625,200 ops/sec ±1.59% (9 runs sampled)
BigInt#mod x 2,279,238 ops/sec ±1.47% (9 runs sampled)
------------------------
Fastest is BigInt#mod
========================

@mathiasbynens
Copy link

Looping in @jakobkummerow, who ran the benchmarks. Jakob, is this something we can share?

@fanatid fanatid merged commit f7baed8 into master Dec 22, 2019
@fanatid fanatid deleted the bigint-bench branch December 22, 2019 20:30
@fanatid fanatid mentioned this pull request Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants