zugriff auf interne referenzen vs. scope referenzen
JavaScript performance comparison
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.
| Test | Ops/sec | |
|---|---|---|
auf interne referenz |
|
pending… |
auf scope referenz |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments