zugriff auf interne referenzen vs. scope referenzen

JavaScript performance comparison

Test case created by Florian Maertl

Preparation code

 
<script>
Benchmark.prototype.setup = function() {
    var someObject = {
      key: "value"
    }
    var Test = function() {
        this.x = someObject;
        var x = someObject;
   
        this.variante1 = function() {
          var value = this.x.key;
          return value;
        }
        this.variante2 = function() {
          var value = someObject.key;
          return value;
        }
        }
       
       
       
    var test = new Test();
};
</script>

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
auf interne referenz
test.variante1();
pending…
auf scope referenz
test.variante2();
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

Add a comment