Run details:
Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:85.0) Gecko/20100101 Firefox/85.0
Firefox 85
Fedora
Desktop
4 years ago
Test name Executions per second
trunc 954215296.0 Ops/sec
round 956758144.0 Ops/sec
floor 956567936.0 Ops/sec
parseFloat to int 4426579.0 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())