Run details:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0
Firefox 108
Windows
Desktop
2 years ago
Test name Executions per second
trunc 1165563008.0 Ops/sec
round 1195078528.0 Ops/sec
floor 1159790208.0 Ops/sec
parseFloat to int 6106418.5 Ops/sec
Tests:
  • trunc

    AخA
     
    Math.trunc(13.37)
    Math.trunc(13.67)
  • round

     
    Math.round(13.37)
    Math.round(13.67)
  • floor

     
    Math.floor(13.37)
    Math.floor(13.67)
  • parseFloat to int

     
    parseFloat(12.17.toFixed())
    parseFloat(12.97.toFixed())