Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Chrome 121
Windows
Desktop
10 months ago
Test name Executions per second
trunc 6495.0 Ops/sec
round 6522.7 Ops/sec
floor 6455.5 Ops/sec
parseFloat to int 3061.5 Ops/sec
~~ 29671.7 Ops/sec
|0 29714.3 Ops/sec
parseInt 6399.4 Ops/sec
parseInt, 10 6496.4 Ops/sec
Script Preparation code:
Tests:
  • trunc

  • round

  • floor

  • parseFloat to int

  • ~~

  • |0

  • parseInt

  • parseInt, 10


;