Run details:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Linux
Desktop
one year ago
Test name Executions per second
BigInt 1139.7 Ops/sec
Number 1208.1 Ops/sec
Script Preparation code:
AخA
 
var bigInt1 = 1000000n
var bigInt2 = 10n
var number1 = 1000000
var number2 = 10
Tests:
  • BigInt

     
    a = bigInt1;
    b = bigInt2;
    for(let i = 0; i < 1000; ++i) {
      c = a << b;
      c = a | b;
      c = a ^ b;
    }
  • Number

     
    a = number1
    b = number2
    for(let i = 0; i < 1000; ++i) {
      c = a << b;
      c = a | b;
      c = a ^ b;
    }