142
St
startsInvasion / files
startsInvasion / libs / node_modules / bean / support / qwery / tests / benchmarks.html
2.3 KB
1<!DOCTYPE HTML> 2<html lang="en-us"> 3 <head> 4 <meta http-equiv="Content-type" content="text/html; charset=utf-8"> 5 <title>Qwery Benchmarks</title> 6 <style type="text/css"> 7 body { 8 width: 700px; 9 margin: 0 auto; 10 font: 300 18px 'helvetica neue', helvetica, arial; 11 } 12 13 ul,li { 14 list-style: none; 15 margin: 0; 16 padding: 0; 17 } 18 li { 19 font-size: 28px; 20 } 21 h1 { 22 font: 300 36px 'helvetica neue', helvetica, arial; 23 } 24 </style> 25 <script src="../vendor/nw.js"></script> 26 <script src="../vendor/sizzle.js"></script> 27 <script src="../src/qwery.js"></script> 28 <script type="text/javascript"> 29 var Q = qwery.noConflict(); 30 </script> 31 </head> 32 <body> 33 <h1>Selector Benchmarks</h1> 34 <ul> 35 <li>Qwery: <span id="qwery">0</span>ms</li> 36 <li>Sizzle: <span id="sizzle">0</span>ms</li> 37 <li>NW: <span id="nw">0</span>ms</li> 38 </ul> 39 <div foo="bar"></div> 40 <div class="a"></div> 41 <div id="boosh"> 42 <div class="a b"> 43 <div class="d e" test="fg" id="booshTest"></div> 44 <em test="f g"></em> 45 <span class="h i a"></span> 46 </div> 47 </div> 48 <div id="attr-test1" -data-attr></div> 49 <div id="attr-test2" -data-attr></div> 50 <div id="attr-test3" class="found you" -data-attr title="whatup duders"></div> 51 <script type="text/javascript"> 52 var i = 0, j; 53 var start = +new Date; 54 var tests = ['div .a', 'div', 'div#attr-test3.found.you[title="whatup duders"]', '#boosh', '.a', 'div.a', '#boosh a']; 55 while (i < 1000) { 56 i++; 57 for (j = 0; j < tests.length; j++) { 58 Q(tests[j]); 59 } 60 } 61 62 var qweryTime = +new Date - start; 63 i = 0; 64 var start2 = +new Date; 65 while (i < 1000) { 66 i++; 67 for (j = 0; j < tests.length; j++) { 68 Sizzle(tests[j]); 69 } 70 } 71 var sizzleTime = +new Date - start2; 72 73 i = 0; 74 var start3 = +new Date; 75 while (i < 1000) { 76 i++; 77 for (j = 0; j < tests.length; j++) { 78 NW.Dom.select(tests[j]); 79 } 80 } 81 var nwTime = +new Date - start3; 82 83 84 85 86 Q('#qwery')[0].innerHTML = qweryTime; 87 Sizzle('#sizzle')[0].innerHTML = sizzleTime; 88 NW.Dom.select('#nw')[0].innerHTML = nwTime; 89 </script> 90 </body> 91</html>