diff --git a/package.json b/package.json index 6b5ef58..d837484 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "lint": "eslint --ext .js,.vue . docs/.vuepress", "test": "nyc mocha --recursive", - "benchmark": "node tools/benchmark/node", + "benchmark": "node tools/benchmark", "build-docs": "vuepress build docs", "watch-docs": "vuepress dev docs", "build-parser": "pegjs -c src/pegjs.config.js", diff --git a/tools/benchmark/README.md b/tools/benchmark/README.md index 3fea73f..5e23082 100644 --- a/tools/benchmark/README.md +++ b/tools/benchmark/README.md @@ -3,5 +3,5 @@ This directory contains the benchmark suite that measures the speed of parsers g From the root of the repository: ```sh -node tools/benchmark/node +node tools/benchmark ``` diff --git a/tools/benchmark/browser.js b/tools/benchmark/browser.stub.js similarity index 95% rename from tools/benchmark/browser.js rename to tools/benchmark/browser.stub.js index bf0d9f5..d9cd376 100644 --- a/tools/benchmark/browser.js +++ b/tools/benchmark/browser.stub.js @@ -78,8 +78,6 @@ $( "#run" ).click( () => { readFile( file ) { - if ( file.indexOf( "benchmark" ) === 0 ) file = "tools/" + file; - return $.ajax( { type: "GET", url: `https://raw.githubusercontent.com/pegjs/pegjs/${ BRANCH }/` + file, @@ -98,7 +96,8 @@ $( "#run" ).click( () => { appendResult( "individual", test.title, - "benchmark/" + benchmark.id + "/" + test.file, + "tools/benchmark/" + benchmark.id + "/" + test.file, + `https://raw.githubusercontent.com/pegjs/pegjs/${ BRANCH }/tools/benchmark/${ benchmark.id }/${ test.file }`, inputSize, parseTime ); diff --git a/tools/benchmark/node.js b/tools/benchmark/index.js similarity index 98% rename from tools/benchmark/node.js rename to tools/benchmark/index.js index 5735bac..f137940 100644 --- a/tools/benchmark/node.js +++ b/tools/benchmark/index.js @@ -207,8 +207,6 @@ Runner.run( benchmarks, runCount, options, { readFile( file ) { - if ( file.startsWith( "benchmark" ) ) file = path.join( "tools", file ); - return fs.readFileSync( file, "utf8" ); }, diff --git a/tools/benchmark/runner.js b/tools/benchmark/runner.js index 8134443..01094dd 100644 --- a/tools/benchmark/runner.js +++ b/tools/benchmark/runner.js @@ -85,7 +85,7 @@ const Runner = { callbacks.testStart( benchmark, test ); - const input = callbacks.readFile( "benchmark/" + benchmark.id + "/" + test.file ); + const input = callbacks.readFile( "tools/benchmark/" + benchmark.id + "/" + test.file ); let parseTime = 0; for ( let i = 0; i < runCount; i++ ) {