inheritance-vs-runtime-runtime2
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function Inheritance() {}
Inheritance.prototype.method = function () {
return this;
};
Inheritance.prototype.method2 = function () {
return this instanceof Inheritance;
};
function Runtime() {
this.method = function () {
return this;
};
this.method2 = function () {
return this instanceof Runtime;
};
}
function Runtime2() {
return {
method: function() {return this;},
method2: function() {return this instanceof Runtime2}
}
}
var result = [];
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
inheritance |
|
pending… |
runtime |
|
pending… |
runtime2 |
|
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
0 comments