From 2e0be111cc662f502f705340963ac3554cbbd98c Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 13 Oct 2010 15:36:01 -0400 Subject: [PATCH 1/2] Run each test 20 times, show total execution time --- header.html | 1 + system/template.php | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/header.html b/header.html index e379364..c28ced8 100755 --- a/header.html +++ b/header.html @@ -2,6 +2,7 @@

SlickSpeed

Speed/validity selectors test for frameworks.

Every framework runs in his own iFrame, thus no conflicts can happen. Tests are run selector by selector, with an interval to prevent the browser from freeezing.

Tests are run in a neutral environment, no library or framework is included in the main javascript test.

+

Times displayed are the sum of each test run 20 times.

Under firefox, disable firebug for more accurate results, as most frameworks could throw warnings, slowing down the dom query process.

Tests are run against a local copy of this document.

\ No newline at end of file diff --git a/system/template.php b/system/template.php index 5a8fdcf..9785c46 100755 --- a/system/template.php +++ b/system/template.php @@ -16,18 +16,31 @@ function test(selector){ try { var start = new Date().getTime(); - var i = 1; var elements = (selector); - i ++; (selector); - i ++; (selector); - i ++; (selector); - i ++; (selector); - i ++; (selector); - var end = ((new Date().getTime() - start) / i); - return {'time': Math.round(end), 'found': get_length(elements)}; + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + (selector); + var end = ((new Date().getTime() - start)); + return {'total time': Math.round(end), 'found': get_length(elements)}; } catch(err){ if (elements == undefined) elements = {length: -1}; - return ({'time': (new Date().getTime() - start) / i, 'found': get_length(elements), 'error': err}); + return ({'total time': (new Date().getTime() - start) / i, 'found': get_length(elements), 'error': err}); } }; From fc5bd5e4d093378f43daf17fda051277bc5f2c6b Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 13 Oct 2010 15:40:46 -0400 Subject: [PATCH 2/2] Run each test 20 times, show total execution time --- system/template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/system/template.php b/system/template.php index 9785c46..9e58bac 100755 --- a/system/template.php +++ b/system/template.php @@ -36,11 +36,11 @@ function test(selector){ (selector); (selector); (selector); - var end = ((new Date().getTime() - start)); - return {'total time': Math.round(end), 'found': get_length(elements)}; + var end = (new Date().getTime() - start); + return {'time': Math.round(end), 'found': get_length(elements)}; } catch(err){ if (elements == undefined) elements = {length: -1}; - return ({'total time': (new Date().getTime() - start) / i, 'found': get_length(elements), 'error': err}); + return ({'time': (new Date().getTime() - start), 'found': get_length(elements), 'error': err}); } };