Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
Firefox 123
Windows
Desktop
9 months ago
Test name Executions per second
trunc 3857105.2 Ops/sec
round 3845987.2 Ops/sec
floor 3858572.5 Ops/sec
parseFloat to int 11734.7 Ops/sec
~~ 3888677.5 Ops/sec
|0 3912829.8 Ops/sec
parseInt 3732859.0 Ops/sec
parseInt, 10 3873018.2 Ops/sec
Script Preparation code:
Tests:
  • trunc

  • round

  • floor

  • parseFloat to int

  • ~~

  • |0

  • parseInt

  • parseInt, 10


;