remove acorn compiled source

This commit is contained in:
Sebastian McKenzie
2015-03-22 04:09:18 +11:00
parent 37072737b9
commit 2cbbd86552
8 changed files with 0 additions and 894 deletions

View File

@@ -1,112 +0,0 @@
(function() {
var driver, acorn;
if (typeof require !== "undefined") {
driver = require("./driver.js");
require("./tests.js");
require("./tests-harmony.js");
require("babel/register")
acorn = require("../src")
} else {
driver = window;
acorn = window.acorn;
}
var htmlLog = typeof document === "object" && document.getElementById('log');
var htmlGroup = htmlLog;
function group(name) {
if (htmlGroup) {
var parentGroup = htmlGroup;
htmlGroup = document.createElement("ul");
var item = document.createElement("li");
item.textContent = name;
item.appendChild(htmlGroup);
parentGroup.appendChild(item);
}
if (typeof console === "object" && console.group) {
console.group(name);
}
}
function groupEnd() {
if (htmlGroup) {
htmlGroup = htmlGroup.parentElement.parentElement;
}
if (typeof console === "object" && console.groupEnd) {
console.groupEnd(name);
}
}
function log(title, message) {
if (htmlGroup) {
var elem = document.createElement("li");
elem.innerHTML = "<b>" + title + "</b> " + message;
htmlGroup.appendChild(elem);
}
if (typeof console === "object") console.log(title, message);
}
var stats, modes = {
Normal: {
config: {
parse: acorn.parse
}
},
Loose: {
config: {
parse: acorn.parse_dammit,
loose: true,
filter: function (test) {
var opts = test.options || {};
if (opts.loose === false) return false;
return (opts.ecmaVersion || 5) <= 6;
}
}
}
};
function report(state, code, message) {
if (state != "ok") {++stats.failed; log(code, message);}
++stats.testsRun;
}
group("Errors");
for (var name in modes) {
group(name);
var mode = modes[name];
stats = mode.stats = {testsRun: 0, failed: 0};
var t0 = +new Date;
driver.runTests(mode.config, report);
mode.stats.duration = +new Date - t0;
groupEnd();
}
groupEnd();
function outputStats(name, stats) {
log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " +
(stats.failed ? stats.failed + " failures." : "all passed."));
}
var total = {testsRun: 0, failed: 0, duration: 0};
group("Stats");
for (var name in modes) {
var stats = modes[name].stats;
outputStats(name + " parser", stats);
for (var key in stats) total[key] += stats[key];
}
outputStats("Total", total);
groupEnd();
if (total.failed && typeof process === "object") {
process.stdout.write("", function() {
process.exit(1);
});
}
})();

View File

@@ -1,96 +0,0 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>Acorn benchmark</title>
<script src="../acorn.js"></script>
<script src="compare/esprima.js"></script>
<script src="compare/traceur.js"></script>
<script src="jquery-string.js"></script>
<script src="codemirror-string.js"></script>
<style>
td { text-align: right; padding-right: 20px; }
th { text-align: left; padding-right: 40px; }
body { max-width: 50em; padding: 1em 2em; }
h1 { font-size: 150%; }
</style>
</head>
<h1>Acorn/Esprima/Traceur speed comparison</h1>
<p>This will run each of the three ES6 parsers on the source code of
jQuery 1.11.1 and CodeMirror 3.0b1 for five seconds, and show a table
indicating the number of lines parsed per second. Note that Traceur
always stores location data, and is thus not fairly compared by the
benchmark <em>without</em> location data.<p>
<p>Also note that having the developer tools open in Chrome, or
Firebug in Firefox <em>heavily</em> influences the numbers you get. In
Chrome, the effect even lingers (in the tab) after you close the
developer tools. Load in a fresh tab to get (halfway) stable
numbers.</p>
<button onclick="run(false)">Compare <strong>without</strong> location data</button>
<button onclick="run(true)">Compare <strong>with</strong> location data</button>
<button onclick="run(false, true)">Run only Acorn</button>
<span id="running"></span>
<script>
var sourceFileName = 'source.js';
function runAcorn(code, locations) {
acorn.parse(code, {ecmaVersion: 6, locations: locations, sourceFile: sourceFileName});
}
function runEsprima(code, locations) {
esprima.parse(code, {loc: locations, source: sourceFileName});
}
function runTraceur(code) {
var file = new traceur.syntax.SourceFile(sourceFileName, code);
var parser = new traceur.syntax.Parser(file);
parser.parseScript();
}
var totalLines = codemirror30.split("\n").length + jquery111.split("\n").length;
var nowHost = (typeof performance === 'object' && 'now' in performance) ? performance : Date;
function benchmark(runner, locations) {
// Give it a chance to warm up (first runs are usually outliers)
runner(jquery111, locations);
runner(codemirror30, locations);
var t0 = nowHost.now(), t1, lines = 0;
for (;;) {
runner(jquery111, locations);
runner(codemirror30, locations);
lines += totalLines;
t1 = nowHost.now();
if (t1 - t0 > 5000) break;
}
return lines / ((t1 - t0) / 1000);
}
function showOutput(values) {
var html = "<hr><table>";
for (var i = 0; i < values.length; ++i)
html += "<tr><th>" + values[i].name + "</td><td>" + Math.round(values[i].score) + " lines per second</td><td>" +
Math.round(values[i].score * 100 / values[0].score) + "%</td></tr>";
document.body.appendChild(document.createElement("div")).innerHTML = html;
}
function run(locations, acornOnly) {
var running = document.getElementById("running");
running.innerHTML = "Running benchmark...";
var data = [{name: "Acorn", runner: runAcorn},
{name: "Esprima", runner: runEsprima},
{name: "Traceur", runner: runTraceur}];
if (acornOnly) data.length = 1;
var pos = 0;
function next() {
data[pos].score = benchmark(data[pos].runner, locations);
if (++pos == data.length) {
running.innerHTML = "";
showOutput(data);
} else setTimeout(next, 100);
}
setTimeout(next, 50);
}
</script>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,14 +0,0 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>Acorn test suite</title>
<script src="../dist/acorn.js"></script>
<script src="../dist/acorn_loose.js"></script>
<script src="driver.js"></script>
<script src="tests.js" charset="utf-8"></script>
<script src="tests-harmony.js" charset="utf-8"></script>
</head>
<body>
<ul id="log"></ul>
<script src="run.js"></script>
</body>

File diff suppressed because one or more lines are too long