create
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
window.create0 = Object.create;
window.create1 = function( p ) {
function F() {}
F.prototype = p;
return new F();
}
function F() {}
window.create2 = function( p ) {
F.prototype = p;
var o = new F();
F.prototype = null;
return o;
}
window.create3 = function( p ) {
F.prototype = p;
return new F();
}
window.Type = function() {};
window.p = Type.prototype;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
new |
|
pending… |
Object.create |
|
pending… |
shim |
|
pending… |
optimized shim (leek-safe) |
|
pending… |
optimized shim (leek-unsafe) |
|
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
- Revision 2: published by pow
0 comments