ajile: Path Resolution Speed Test

JavaScript performance comparison

Revision 3 of this test case created by Mike Lee

Info

Intended to compare how quickly each ajile version resolves paths from module names but technical difficulties loading ajile before the tests is blocking progress :-(

Looks like this is a jsPerf limitation. Needs to support executing dynamically inserted scripts in setup() before executing individual test cases.

Preparation code

<script type="text/javascript">

var versions =
[  "src"
,  "1.2.1"   //, "1.1.5"
,  "0.9.9.2" //, "0.9.9.1", "0.9.9", "0.9.8",  "0.9.5", "0.9"
,  "0.7.9"   //, "0.7.8", "0.7.6"
,  "0.6.5"   //, "0.6.2"
];

function ajile () {
   var script   = document.createElement ("script");
   script.type  = "text/javascript";
   script.async = false;
   ajile.script = script;

   var version  = versions.pop();
   version      = version ? ("."+version+".") : ".";
   var lib      = ajile.map [version];
   script.src   = ajile [lib || "net"]
                + ajile.name + version + ajile.config
                ;
   document.lastChild.firstChild.appendChild (script);
}

ajile.map =
{  ".src."  : "github"
,  ".1.2.1.": "github"
};

ajile.github = "https://raw.github.com/iskitz/ajile/master/lib/ajile/";
ajile.net    = "//ajile.net/use/";
ajile.name  = "com.iskitz.ajile";
ajile.config = "js?debugoff,mvcoff,mvcshareoff";

ajile.resolvePath = function testPathResolutionSpeed() {
  var thread = setInterval (function isAjileLoaded() {
     if (!(this.Ajile && this.Import)) return;
     Import ("a.deeply.nested.non-existent.module");
     deferred.resolve();
     clearInterval (thread);
  },10);
};

ajile.cleanup = function cleanup() {
   Ajile.Unload ("a.deeply.nested.non-existent.module");
   Ajile.Unload ();
   document.lastChild.firstChild.removeChild (ajile.script);
   delete ajile.script;
};

</script>
<script>
Benchmark.prototype.setup = function() {
    ajile();
};

Benchmark.prototype.teardown = function() {
    ajile.cleanup();
   
};
</script>

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
ajile
// async test
ajile.resolvePath();
pending…
ajile 1.2.1
// async test
ajile.resolvePath();
pending…
ajile 0.9.9.2
// async test
ajile.resolvePath();
pending…
ajile 0.7.9
// async test
ajile.resolvePath();
pending…
ajile 0.6.5
// async test
ajile.resolvePath();
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:

0 comments

Add a comment