Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@mathiasbynens can you share benchmark which was used in article? https://v8.dev/features/bigint#use-cases
bn.js
VSBigInt
$ 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 ========================