Script Preparation code:
AخA
 
var mathFloor = Math.floor;
var random = Math.random;
var unsafeFloor = n => n | 0;
var fastFloor = n => {
    if (n >= 0 && n < 0x80000000) {
      return n | 0;
    }
    if (n > -0x80000000 && n < 0) {
      return (n - 1) | 0;
    }
    return mathFloor(n);
};
Tests:
  • floor

     
    mathFloor(random()*10);
  • fast floor

     
    fastFloor(random()*10);
  • unsafe floor

     
    unsafeFloor(random()*10);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    floor
    fast floor
    unsafe floor

    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; rv:99.0) Gecko/20100101 Firefox/99.0
Firefox 99 on Mac OS X 10.15
View result in a separate tab
Test name Executions per second
floor 1012067264.0 Ops/sec
fast floor 354553920.0 Ops/sec
unsafe floor 965839296.0 Ops/sec