Tests:

Historical Performance Data aggregated from 5 community runs

Desktop Results:
Chrome 5 runs
~~
1033.4M/s
0 |
1030.0M/s
trunc
9.1M/s
round
9.1M/s
floor
9.0M/s
parseInt
9.0M/s
parseInt, 10
8.9M/s
parseFloat to int
3.5M/s

Fastest: ~~ (297.4x faster)

View exact numbers
  • ~~: 1,033,449,856 ops/sec
  • 0 |: 1,030,017,792 ops/sec
  • trunc: 9,063,010 ops/sec
  • round: 9,058,531 ops/sec
  • floor: 9,045,109 ops/sec
  • parseInt: 8,951,245 ops/sec
  • parseInt, 10: 8,911,959 ops/sec
  • parseFloat to int: 3,475,483 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
    trunc
    round
    floor
    parseFloat to int
    ~~
    0 |
    parseInt
    parseInt, 10

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36
Chrome 122 on Mac OS X 10.15.7
View result in a separate tab
~~
160.4M/s
0 |
154.3M/s
floor
7.5M/s
round
7.5M/s
trunc
7.4M/s
parseInt, 10
7.4M/s
parseInt
7.3M/s
parseFloat to int
2.9M/s
View exact numbers
Test name Executions per second
~~ 160,367,520 Ops/sec
0 | 154,319,904 Ops/sec
floor 7,451,652 Ops/sec
round 7,450,237 Ops/sec
trunc 7,436,124 Ops/sec
parseInt, 10 7,398,285 Ops/sec
parseInt 7,348,802 Ops/sec
parseFloat to int 2,929,326 Ops/sec