diff options
author | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-14 15:39:19 +0000 |
---|---|---|
committer | mensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2008-11-14 15:39:19 +0000 |
commit | 1c5685d68f1b73270fb814fe04cbb490eb90ba5f (patch) | |
tree | 3d3ada08a934b96fc31531f1327690d7edc6f766 /includes/js/dojox/lang/tests/fun_perf.html | |
parent | 104d59099e048688c4dbac37d72137006e396558 (diff) | |
download | semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.gz semanticscuttle-1c5685d68f1b73270fb814fe04cbb490eb90ba5f.tar.bz2 |
Minor fix: Remove DOJO library (60Mo) replaced by link to Google CDN (online DOJO library)
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@159 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'includes/js/dojox/lang/tests/fun_perf.html')
-rw-r--r-- | includes/js/dojox/lang/tests/fun_perf.html | 176 |
1 files changed, 0 insertions, 176 deletions
diff --git a/includes/js/dojox/lang/tests/fun_perf.html b/includes/js/dojox/lang/tests/fun_perf.html deleted file mode 100644 index 9d19a60..0000000 --- a/includes/js/dojox/lang/tests/fun_perf.html +++ /dev/null @@ -1,176 +0,0 @@ -<html> - <head> - <title>clocking fun</title> - <style type="text/css"> - @import "../../../dojo/resources/dojo.css"; - </style> - <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug:true"></script> - <script type="text/javascript" src="../functional.js"></script> - <script type="text/javascript" src="../functional/sequence.js"></script> - <script type="text/javascript" src="../functional/fold.js"></script> - <script type="text/javascript"> - dojo.addOnLoad(function(){ - var LEN = 2000, ITER = 200, b, e, tests = {}, - df = dojox.lang.functional, - sample = df.repeat(LEN, "+1", 0), - add = df.lambda("+"), - isOdd = df.lambda("%2"); - - var clock = function(body){ - var b = new Date(); - body(); - var e = new Date(); - return e.getTime() - b.getTime(); // in ms - }; - - var log = function(name, body){ - b = new Date(); - var ms = clock(body); - e = new Date(); - console.log(name + ":", ms); - }; - - // filter - tests["raw filter"] = function(){ - for(var i = 0; i < ITER; ++i){ - var t = []; - for(var j = 0; j < sample.length; ++j){ - if(isOdd(sample[j])){ t.push(sample[j]); } - } - } - }; - tests["dojo.filter"] = function(){ - for(var i = 0; i < ITER; ++i){ - dojo.filter(sample, isOdd); - } - }; - tests["df.filter"] = function(){ - for(var i = 0; i < ITER; ++i){ - df.filter(sample, isOdd); - } - }; - if(sample.filter){ - tests["Array.prototype.filter"] = function(){ - for(var i = 0; i < ITER; ++i){ - sample.filter(isOdd); - } - }; - } - - // map - tests["raw map"] = function(){ - for(var i = 0; i < ITER; ++i){ - var t = []; - for(var j = 0; j < sample.length; ++j){ - t.push(isOdd(sample[j])); - } - } - }; - tests["dojo.map"] = function(){ - for(var i = 0; i < ITER; ++i){ - dojo.map(sample, isOdd); - } - }; - tests["df.map"] = function(){ - for(var i = 0; i < ITER; ++i){ - df.map(sample, isOdd); - } - }; - if(sample.map){ - tests["Array.prototype.map"] = function(){ - for(var i = 0; i < ITER; ++i){ - sample.map(isOdd); - } - }; - } - - // forEach - tests["raw forEach"] = function(){ - for(var i = 0; i < ITER; ++i){ - for(var j = 0; j < sample.length; ++j){ - isOdd(sample[j]); - } - } - }; - tests["dojo.forEach"] = function(){ - for(var i = 0; i < ITER; ++i){ - dojo.forEach(sample, isOdd); - } - }; - tests["df.forEach"] = function(){ - for(var i = 0; i < ITER; ++i){ - df.forEach(sample, isOdd); - } - }; - if(sample.forEach){ - tests["Array.prototype.forEach"] = function(){ - for(var i = 0; i < ITER; ++i){ - sample.forEach(isOdd); - } - }; - } - - // reduce - tests["raw reduce"] = function(){ - for(var i = 0; i < ITER; ++i){ - var z = 0; - for(var j = 0; j < sample.length; ++j){ - z = add(z, sample[j]); - } - } - }; - tests["df.reduce"] = function(){ - for(var i = 0; i < ITER; ++i){ - df.reduce(sample, add, 0); - } - }; - if(sample.reduce){ - tests["Array.prototype.reduce"] = function(){ - for(var i = 0; i < ITER; ++i){ - sample.reduce(add, 0); - } - }; - } - - // reduceRight - tests["raw reduceRight"] = function(){ - for(var i = 0; i < ITER; ++i){ - var z = 0; - for(var j = sample.length - 1; j >= 0; --j){ - z = add(z, sample[j]); - } - } - }; - tests["df.reduceRight"] = function(){ - for(var i = 0; i < ITER; ++i){ - df.reduceRight(sample, add, 0); - } - }; - if(sample.reduceRight){ - tests["Array.prototype.reduceRight"] = function(){ - for(var i = 0; i < ITER; ++i){ - sample.reduceRight(add, 0); - } - }; - } - - var keys = df.keys(tests), i = 0; - - var doTest = function(){ - log(keys[i], tests[keys[i]]); - ++i; - if(i < keys.length){ - setTimeout(doTest, 1); - }else{ - console.log("that's all"); - } - }; - - setTimeout(doTest, 1); - }); - </script> - </head> - <body> - <p>This test is meant to run with Firebug.</p> - </body> -</html> |