micro-bench-property-get
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
var key = "has", object = {has:key}, result;
function get(object, key) {
return object[key];
}
try {
object.__defineGetter__("key", function(){
return object[key];
});
}catch(o){}
try {
Object.defineProperty(object, "get", {
get: function () {
return object[key];
}
});
Object.defineProperty(object, "ovl", {
configurable: true,
get: function () {
return Object.defineProperty(object, "ovl", {configurable: true, value:object[key]}).ovl;
}
});
}catch(o){}
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
direct access |
|
pending… |
dynamic access |
|
pending… |
dynamic access key |
|
pending… |
method access |
|
pending… |
__defineGetter__ |
|
pending… |
Object.defineProperty get |
|
pending… |
Object.defineProperty once |
|
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. Here’s a list of current revisions for this page:
- Revision 1: published by WebReflection
- Revision 2: published
0 comments