Object.create() vs. constructor vs. object literal
JavaScript performance comparison
Preparation code
<script>
var A = function() {
this._x = 0;
};
var B = function() {
this._z = 0;
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Object.create() using in-place property object |
|
pending… |
Object.create() using pre-defined property object |
|
pending… |
Constructor function |
|
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 7: published by Jeremy Ashkenas
- Revision 9: published
- Revision 10: published
- Revision 11: published by Gavin Huang
- Revision 12: published by Joseph Gentle
0 comments