ajile: Namespace to Path Resolution Speed Test

JavaScript performance comparison

Revision 15 of this test case created by Mike Lee

Info

Tests how quickly specific ajile versions resolve a multi-level namespace to its actual URL.

Preparation code

<form id="checkboxes" style="overflow:auto;"></form>
<div id="log"></div>

<!-- Preload ajile's namespace resolution support script. -->
<script src="//ajile.net/test/net.ajile.test.speed.js"></script>

<script type="text/javascript">
/* Longest availability
    1.9.9    3.3 m
    1.2.1    5.5 y
    0.9.9.2  2.75m
    0.7.9    4.5 m
    0.7      2.5 m
*/


function ajile (version)
{
   (version == "newest") && (version = "");

   var script     = document.createElement ("script");
   script.type    = "text/javascript";
   script.async   = !true;
   script.onload  = ajile.getOnLoad  (version);
   script.onerror = ajile.getOnError (version);

   !ajile.host &&  (ajile.host =
                       {/*""      : "github"
                       ,  ".src." : "github"
                       ,*/

                       });

   version  = version ? ("."+version+".") : ".";
   var host = ajile.host [version];

   script.src = ajile [host || "site"]
              + ajile.space + version + ajile.config
              ;
   document.lastChild.firstChild.appendChild (script);
}//end:ajile()

ajile.getOnError = function getAjileOnErrorHandler (version) {
    return function onAjileLoadError() {
        ajile.loadVersions();
        var msg = "ajile."+ (version || "js") +" not loaded :-(";
        ajile.log (msg);
    };
};

ajile.getOnLoad = function getAjileOnLoadHandler (version) {
    var id = "ajile-"+ (ajile.next + 1);

    return function onAjileLoaded() {
        var global     = ajile.global
          , Ajile      = global.Ajile
          , Include    = global.Include
          , Namespace  = global.Namespace
          , ver$ion    = Ajile.GetVersion()
          , ajil3      = version ? ajile [version] : ajile
          ;

        ajil3.resolveNamespace = function resolveNamespace () {
            Include ("net.ajile.test.speed");
        };

        Namespace ("net", "http://ajile.net/test/");

        ajile.boxes.innerHTML += '<span'
                              +  ' style="margin:5px;"'
                              +  '><input id="'+id+'"'
                              +  ' type="checkbox"'
                              +  ' style="margin:0px 2px;"'
                              +  ' value="'+version+'"'
                              +  ' onclick='
                              +  '   "ajile.addTest(this.value)"'
                              +  '><label for="'+id+'">'
                              +  ' ajile.'+ (version || "js")
                              +  '</label>'
                              +  '</span>'
                              ;
        (delete com.iskitz.ajile)  // Workarounds for ajile's
        &&  (Ajile = undefined);   // launch override regression
        ajile.loadVersions();      // in versions 1.7.3 to 1.9.9.
    };
};//end:ajile.getOnLoad()

ajile.loadVersions = function loadAjileVersions () {
    /*
       Preload ajile scripts so tests won't be affected by
       network latency. Load scripts sequentially to avoid
       override launch option regression in 1.7.3 to 1.9.9.
    */

    isNaN (ajile.next) && (ajile.next = ajile.versions.length-1);

    if (ajile.next < 0) {
        ajile.log (ajile.versions.length +" ajile requests!");
        return;
    }

    var version = ajile.versions [ajile.next--];

    ajile [version] =
        ajile.missing
        ||  (ajile.missing =
                { resolveNamespace:
                    function cantResolveAjileNamespace () {
                        ajile.log (":-( ajile not loaded )-:");
            }});

    ajile (version);
};//end:ajile.loadVersions()

ajile.addTest = function addAjileTest (version)
{
    !version && (version = "newest");
    !ajile.addTest.count && (ajile.addTest.count = 1);

    var index =  ++ajile.addTest.count;

    var out   = document
                .getElementById ("test-table")
                .getElementsByTagName ("tbody")[0]
              ;

    out.innerHTML +=
        '<tr style="overflow:hidden;">\
            <th scope="row" id="title-'
+index+'"><div>ajile.'+version+'</div></th>\
            <td class="code"><pre><code>ajile[<span class="st0">&quot;'
+version+'&quot;</span>].resolveNamespace<span class="sy0">();</span></code></pre></td>\
            <td id="results-'
+index+'" class="results">ready</td>\
        </tr>\
        '
;

    ajile.global.ui
    &&  ui.add ('ajile.'+ (version || 'js')
               ,"ajile[\""+version+"\"].resolveNamespace();"
               );
};

ajile.log = function ajileLog (msg) {
    !ajile.logger
    &&  (ajile.logger = document.getElementById ("log"));
    ajile.logger.innerHTML += "<br>"+ (msg || "\r\n");
    ajile.global.console && console.log (msg);
};

ajile.global = this;
ajile.boxes  = document.getElementById ("checkboxes");
ajile.github = "https://raw.github.com/iskitz/ajile/master/use/";
ajile.site   = "http://ajile.net/use/";
ajile.space  = "com.iskitz.ajile";
ajile.config = "js?cloak,debugoff,mvcoff,mvcshareoff,override";
ajile.versions =
    ["0.5"  , "0.5.5"
    ,"0.6.2", "0.6.5"
    ,"0.7"  , "0.7.5", "0.7.8", "0.7.9"
    ,"0.9"  , "0.9.5", "0.9.8", "0.9.9", "0.9.9.1", "0.9.9.2"
    ,"1.1.5", "1.2.1", "1.3.8", "1.4.5"
    ,"1.5.0", "1.5.3", "1.5.5"
    ,"1.6.1", "1.6.8"
    ,"1.7.3"
    ,"1.9.3", "1.9.8", "1.9.9"
    ,"newest"
    ];

ajile.loadVersions();
</script>
<script>
Benchmark.prototype.teardown = function() {
    delete net.ajile.test.speed;
   
};
</script>

Preparation code output

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.error
throw new Error ("This suite dynamically adds tests.");
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