Math.Floor vs Number | 0 vs ~~Number

Benchmark created on


Description

This test benchmarks the performance for Math.floor() or Number | 0 or ~~Number.

Setup

var pi = 3.14;

Test runner

Ready to run.

Testing in
TestOps/sec
Math.floor
var final = Math.floor(pi);
ready
Number | 0
var final = pi | 0;
ready
~~Number
var final = ~~pi;
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.