class init test
JavaScript performance comparison
Info
Test startup instantiation speed vs instantiation on demand. Useful considerations for working with huge monolithic class based JS bases in applications.
Preparation code
<script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.1/mootools.js"></script>
<script>
var A2 = (function() {
return new Class({
initialize: function()
{
}
}); });
var BProto2 = {
initialize: function()
{
}
}
var B2 = new Class({
initialize: function()
{
}
});
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
closure non executed |
|
pending… |
Class Proto non executed |
|
pending… |
Class init Obj |
|
pending… |
Instantiation from Closure |
|
pending… |
Instantiation from BProto |
|
pending… |
Instantiation from Class Obj |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments