Script Preparation code:
AخA
 
var num = Math.random() * 100;
Tests:
  • Trunc

     
    Math.trunc(num);
  • Floor

     
    Math.floor(num);
  • ParseInt

     
    parseInt(num);
  • Bitwise invert2

     
    ~~(num);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Trunc
    Floor
    ParseInt
    Bitwise invert2

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 19 days ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Chrome 134 on Windows
View result in a separate tab
Test name Executions per second
Trunc 133906240.0 Ops/sec
Floor 131874392.0 Ops/sec
ParseInt 90776032.0 Ops/sec
Bitwise invert2 141727376.0 Ops/sec