Script Preparation code:
AخA
 
var somenum = 7.3, rounded;
Tests:
  • Or bitwise

     
    rounded = (0.5 + somenum) | 0;
  • Double bitwise not

     
    rounded = ~~ (0.5 + somenum);
  • Left bitwise shift

     
    rounded = (0.5 + somenum) << 0;
  • Math.round

     
    rounded = Math.round(somenum);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Or bitwise
    Double bitwise not
    Left bitwise shift
    Math.round

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Chrome 136 on Windows
View result in a separate tab
Test name Executions per second
Or bitwise 5587303.5 Ops/sec
Double bitwise not 5582126.5 Ops/sec
Left bitwise shift 6439524.0 Ops/sec
Math.round 7427132.5 Ops/sec