Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding benchmarkjs and a folder that will contain our speed tests usi…

…ng it. we need to migrate all our old speed tests to use benchmarkjs
  • Loading branch information...
commit 7af5c4b01a78d9c4780f8005deefcf2a61affeb5 1 parent 39ceb00
Fabio M. Costa fabiomcosta authored
3  .gitmodules
... ... @@ -1,3 +1,6 @@
1 1 [submodule "SlickSpec/Runner"]
2 2 path = SlickSpec/Runner
3 3 url = git://github.com/mootools/mootools-runner.git
  4 +[submodule "speed/benchmarkjs"]
  5 + path = speed/benchmarkjs
  6 + url = https://github.com/mathiasbynens/Benchmark.js.git
1  speed/benchmarkjs
... ... @@ -0,0 +1 @@
  1 +Subproject commit 6468de1128ed93a166f3e1e95c22022415abf839
14 speed/speedtests/index.html
... ... @@ -0,0 +1,14 @@
  1 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2 + "http://www.w3.org/TR/html4/strict.dtd">
  3 +<html>
  4 + <head>
  5 + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
  6 + <title>index</title>
  7 + </head>
  8 + <body>
  9 + <h2>Speed tests</h2>
  10 + <ul>
  11 + <li><a href="setdocument.html">setdocument.html</a></li>
  12 + </ul>
  13 + </body>
  14 +</html>
33 speed/speedtests/setdocument.html
... ... @@ -0,0 +1,33 @@
  1 +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  2 + "http://www.w3.org/TR/html4/strict.dtd">
  3 +<html>
  4 + <head>
  5 + <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
  6 + <title>setdocument</title>
  7 + <script type="text/javascript" src="../benchmarkjs/benchmark.js"></script>
  8 + </head>
  9 + <body>
  10 + <applet code="nano" archive="../benchmarkjs/nano.jar"></applet>
  11 + <script type="text/javascript">
  12 + var suite = new Benchmark.Suite;
  13 + // add tests
  14 + suite.add('RegExp#test', function() {
  15 + /o/.test('Hello World!');
  16 + })
  17 + .add('String#indexOf', function() {
  18 + 'Hello World!'.indexOf('o') > -1;
  19 + })
  20 + .add('String#match', function() {
  21 + !!'Hello World!'.match(/o/);
  22 + })
  23 + // add listeners
  24 + .on('cycle', function(bench) {
  25 + console.log(String(bench));
  26 + })
  27 + .on('complete', function() {
  28 + console.log('Fastest is ' + this.filter('fastest').pluck('name'));
  29 + })
  30 + .run(true);
  31 + </script>
  32 + </body>
  33 +</html>

0 comments on commit 7af5c4b

Please sign in to comment.
Something went wrong with that request. Please try again.