Map Generation

JavaScript performance comparison

Test case created by snollygolly

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  rows = 5;
  cols = 5;
  mapLength = rows * cols;
  i = 0;

};

Benchmark.prototype.teardown = function() {
  i = 0;

};
</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
Two Loops
var r = 0;
var c = 0;
while (r < rows) {
  c = 0;
  while (c < cols) {
    c++;
  }
  r++;
}
pending…
One Loop
while (i < mapLength) {
  var x = (i % cols);
  var y = Math.floor(i / cols);
  i++;
}
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