Permalink
Browse files

Make benchmark suite support the |cache| option

Both the browser and the command-line version of the benchmark suite
runner now allow users to specify a value of the |cache| option.
  • Loading branch information...
1 parent 8f71c07 commit 6f78df19d4f431092a0c83e60b0323aad4c7572b @dmajda dmajda committed Apr 16, 2012
Showing with 11 additions and 3 deletions.
  1. +1 −1 benchmark/index.css
  2. +2 −0 benchmark/index.html
  3. +3 −2 benchmark/index.js
  4. +5 −0 benchmark/run
View
@@ -30,5 +30,5 @@ a, a:visited { color: #3d586c; }
background-color: #f0f0f0;
}
#options #run-count { width: 3em; }
-#options #track-line-and-column { margin-left: 2em; }
+#options #cache, #options #track-line-and-column { margin-left: 2em; }
#options #run { width: 5em; margin-left: 2em; }
View
@@ -11,6 +11,8 @@
<div id="options">
<label for="run-count">Run each test</label>
<input type="text" id="run-count" value="10"> times
+ <input type="checkbox" id="cache">
+ <label for="cache">Use results cache</label>
<input type="checkbox" id="track-line-and-column">
<label for="track-line-and-column">Track line and column</label>
<input type="button" id="run" value="Run">
View
@@ -63,6 +63,7 @@ $("#run").click(function() {
}
var options = {
+ cache: $("#cache").is(":checked"),
trackLineAndColumn: $("#track-line-and-column").is(":checked")
};
@@ -105,7 +106,7 @@ $("#run").click(function() {
},
start: function() {
- $("#run-count, #track-line-and-column, #run").attr("disabled", "disabled");
+ $("#run-count, #cache, #track-line-and-column, #run").attr("disabled", "disabled");
resultsTable.show();
$("#results-table tr").slice(1).remove();
@@ -122,7 +123,7 @@ $("#run").click(function() {
$.scrollTo("max", { axis: "y", duration: 500 });
- $("#run-count, #track-line-and-column, #run").removeAttr("disabled");
+ $("#run-count, #cache, #track-line-and-column, #run").removeAttr("disabled");
}
});
View
@@ -80,6 +80,7 @@ function printHelp() {
util.puts("");
util.puts("Options:");
util.puts(" -n, --run-count <n> number of runs (default: 10)");
+ util.puts(" --cache make tested parsers cache results");
util.puts(" --track-line-and-column make tested parsers track line and column");
}
@@ -127,6 +128,10 @@ while (args.length > 0 && isOption(args[0])) {
}
break;
+ case "--cache":
+ options.cache = true;
+ break;
+
case "--track-line-and-column":
options.trackLineAndColumn = true;
break;

0 comments on commit 6f78df1

Please sign in to comment.