Browse Source

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 10 years ago
parent
commit
6f78df19d4
  1. 2
      benchmark/index.css
  2. 2
      benchmark/index.html
  3. 5
      benchmark/index.js
  4. 5
      benchmark/run

2
benchmark/index.css

@ -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; }

2
benchmark/index.html

@ -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">

5
benchmark/index.js

@ -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");
}
});

5
benchmark/run

@ -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;

Loading…
Cancel
Save