Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
JS BigInt big number performance vx
(version: 0)
Compare Number vs BigInt for big numbers
Comparing performance of:
BigInt vs Number vs pgBigInt vs pgDecimal
Created:
3 years ago
by:
Guest
Go to the latest result
Script Preparation code:
var bigInt1 = 50n var bigInt2 = 9007199254740992n //MaxSafe +1 var number1 = 9007199254740990 //MaxSafe -1 var number2 = 50 //MaxSafe -1 var pgMaxBigInt = 9223372036854775807n // 2^63-1 var pgDiv = 50n var pgDecimal = 92233720368547758070000000000n // max digits before decimal point: 131072
Tests:
BigInt
a = bigInt1 b = bigInt2 c = a - b c = a % b c = a * b c = a + b c = a ** b
Number
a = number1 b = number2 c = a - b c = a % b c = a * b c = a + b c = a ** b
pgBigInt
a = pgMaxBigInt b = pgDiv c = a - b c = a % b c = a * b c = a + b c = a ** b
pgDecimal
a = pgDecimal b = pgDiv c = a - b c = a % b c = a * b c = a + b c = a ** b
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (4)
Previous results
Fork
Test case name
Result
BigInt
Number
pgBigInt
pgDecimal
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0
Browser/OS:
Firefox 146 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Number
12.5M/s
pgBigInt
172K/s
pgDecimal
80K/s
BigInt
0/s
View exact numbers
Test name
Executions per second
✓
Number
12,463,110 Ops/sec
pgBigInt
171,909 Ops/sec
pgDecimal
80,380 Ops/sec
BigInt
0 Ops/sec
Related benchmarks
JS BigInt multiply vs addition
JS BigInt big number performance vx4
bignumber.js vs native benchmark: compareTo
parseInt vs Number BigInts
Comments
Confirm delete:
Do you really want to delete benchmark?