Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS BigInt vs Number
(version: 1)
Comparing BigInt vs Number arithmetic performance using values safely represented by i64 and f64 respectively
Comparing performance of:
Bigint vs Number vs BigInt and textContext vs Number with textContext
Created:
6 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<div id="result">
Script Preparation code:
const result = document.getElementById("result"); const b1 = ((2n ** 63n) - 1n) / 5n; const b2 = 5n; let b3 = 0n; const n1 = Number.MAX_SAFE_INTEGER / 5; const n2 = 5; let n3 = 0;
Tests:
Bigint
b3 = b1 * b2; b3 = b3 - b2; b3 = b3 / b2; b3 = b3 + b2; b3 = b3 % b2;
Number
n3 = n1 * n2; n3 = n3 - n1; n3 = n3 / n2; n3 = n3 + n2; n3 = n3 % n2;
BigInt and textContext
b3 = b1 * b2; b3 = b3 - b2; b3 = b3 / b2; b3 = b3 + b2; b3 = b3 % b2; result.textContent = b3;
Number with textContext
n3 = n1 * n2; n3 = n3 - n1; n3 = n3 / n2; n3 = n3 + n2; n3 = n3 % n2; result.textContent = n3;
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
Bigint
Number
BigInt and textContext
Number with textContext
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
6 months ago
)
User agent:
Mozilla/5.0 (Android 13; Mobile; rv:146.0) Gecko/146.0 Firefox/146.0
Browser/OS:
Firefox Mobile 146 on Android
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Bigint
16053055.0 Ops/sec
Number
9162712.0 Ops/sec
BigInt and textContext
3004331.0 Ops/sec
Number with textContext
2147685.5 Ops/sec
Related benchmarks:
Numver.isInteger vs raw
JS BigInt big number performance v2 BIS 2
JS BigInt big number performance v4
JS BigInt big number performance v5
* 10, round vs trunc vs floor vs parseFloat vs ~~ vs 0 | vs parseInt vs parseInt, 10 loop
JS BigInt big number performance v12
JS BigInt big number performance v9
JavaScript number type benchmark
JavaScript all number type benchmark v2
Comments
Confirm delete:
Do you really want to delete benchmark?