Digit rotation

JavaScript performance comparison

Test case created by 200_success

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  var ln10 = Math.log(10);

};
</script>

Test runner

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

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
div and log
var number = Math.floor(Math.random() * Math.pow(10, 8 * Math.random() + 1));
(number / 10 >> 0) + (number % 10) * Math.pow(10, Math.floor(Math.log(number) / ln10));
pending…
stringify, split, pop, unshift, parseInt
var number = Math.floor(Math.random() * Math.pow(10, 8 * Math.random() + 1))
var arr = number.toString().split('');
arr.unshift(arr.pop());
parseInt(arr.join(''));
pending…
stringify, split, shift, push, parseInt
var number = Math.floor(Math.random() * Math.pow(10, 8 * Math.random() + 1))
var arr = number.toString().split('');
arr.push(arr.shift());
Number(arr.join(''));
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.

0 Comments