Script Preparation code:
Tests:

Historical Performance Data aggregated from 8 community runs

Desktop Results:
Chrome 8 runs
Bitwise n + (n < 0 ? -0.5 : 0.5)>>0
65.3M/s
Math.round(n)
52.3M/s

Fastest: Bitwise n + (n < 0 ? -0.5 : 0.5)>>0 (1.2x faster)

View exact numbers
  • Bitwise n + (n < 0 ? -0.5 : 0.5)>>0: 65,279,460 ops/sec
  • Math.round(n): 52,342,120 ops/sec

Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.

Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results
  • Test case name Result
    Math.round(n)
    Bitwise n + (n < 0 ? -0.5 : 0.5)>>0

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 11 months ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0
Chrome 140 on Windows
View result in a separate tab
Math.round(n)
274.3M/s
Bitwise n + (n < 0 ? -0.5 : 0.5)>>0
169.6M/s
View exact numbers
Test name Executions per second
Math.round(n) 274,273,184 Ops/sec
Bitwise n + (n < 0 ? -0.5 : 0.5)>>0 169,586,400 Ops/sec