same left vs not in document left

JavaScript performance comparison

Test case created by WoodNeck

Preparation code


      
      <script>
Benchmark.prototype.setup = function() {
  window.repeat = 2000;
  window.element = document.createElement("div");
  element.style.position = "absolute";
  
  setTimeout(function () {
    ui.benchmarks[0].setup = function (){
      document.body.appendChild(element);
    };
  }, 1);

};
</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
same left
for (i = 0; i < repeat; i++) {
  element.style.left = 100 + "px";
}
pending…
not in document left
for (i = 0; i < repeat; i++) {
  element.style.left = i + "px";
}
pending…
do nothing
for (i = 0; i < repeat; i++) {
  var a = i + "px";
}
pending…

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

Compare results of other browsers

0 Comments