Int Casting

JavaScript performance comparison

Test case created by Brenden

Info

Tests the fastest way to cast an integer from a float.

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Floor
function floor() {
  return Math.floor(Math.random() * 100);
}
pending…
Shift
function shift() {
  return (Math.random() * 100) >> 0;
}
pending…
Or
function or() {
  return (Math.random() * 100) | 0
}
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment