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.
redux
David Majda 12 years ago
parent 8f71c07cec
commit 6f78df19d4

@ -30,5 +30,5 @@ a, a:visited { color: #3d586c; }
background-color: #f0f0f0; background-color: #f0f0f0;
} }
#options #run-count { width: 3em; } #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; } #options #run { width: 5em; margin-left: 2em; }

@ -11,6 +11,8 @@
<div id="options"> <div id="options">
<label for="run-count">Run each test</label> <label for="run-count">Run each test</label>
<input type="text" id="run-count" value="10"> times <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"> <input type="checkbox" id="track-line-and-column">
<label for="track-line-and-column">Track line and column</label> <label for="track-line-and-column">Track line and column</label>
<input type="button" id="run" value="Run"> <input type="button" id="run" value="Run">

@ -63,6 +63,7 @@ $("#run").click(function() {
} }
var options = { var options = {
cache: $("#cache").is(":checked"),
trackLineAndColumn: $("#track-line-and-column").is(":checked") trackLineAndColumn: $("#track-line-and-column").is(":checked")
}; };
@ -105,7 +106,7 @@ $("#run").click(function() {
}, },
start: 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(); resultsTable.show();
$("#results-table tr").slice(1).remove(); $("#results-table tr").slice(1).remove();
@ -122,7 +123,7 @@ $("#run").click(function() {
$.scrollTo("max", { axis: "y", duration: 500 }); $.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");
} }
}); });

@ -80,6 +80,7 @@ function printHelp() {
util.puts(""); util.puts("");
util.puts("Options:"); util.puts("Options:");
util.puts(" -n, --run-count <n> number of runs (default: 10)"); 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"); 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; break;
case "--cache":
options.cache = true;
break;
case "--track-line-and-column": case "--track-line-and-column":
options.trackLineAndColumn = true; options.trackLineAndColumn = true;
break; break;

Loading…
Cancel
Save