Update execution files

master
Futago-za Ryuu 6 years ago
parent 8c751e6917
commit dd76ff85d4

@ -23,24 +23,20 @@ if ( process.cwd() !== cwd ) process.chdir( cwd );
// Execution Files // Execution Files
let NEWER_PEGJS_BIN = "bin/peg.js"; function binfile( ...files ) {
let NEWER_BENCHMARK_BIN = "test/benchmark/run";
const ef = { for ( const file of files ) {
get pegjs() { if ( fs.existsSync( file ) ) return file;
return fs.existsSync( NEWER_PEGJS_BIN ) ? NEWER_PEGJS_BIN : "bin/pegjs"; }
}, throw `Could not find: ${ files.join( " || " ) }`;
get benchmark() { }
return fs.existsSync( NEWER_BENCHMARK_BIN ) ? NEWER_BENCHMARK_BIN : "benchmark/run";
},
}; let PEGJS_BIN = binfile( "packages/pegjs/bin/peg.js", "bin/peg.js", "bin/pegjs" );
let BENCHMARK_BIN = binfile( "test/benchmark/run", "benchmark/run" );
// Utils // Utils
@ -65,7 +61,7 @@ function prepare( commit ) {
function runBenchmark() { function runBenchmark() {
return parseFloat( return parseFloat(
exec( "node " + ef.benchmark ) exec( "node " + BENCHMARK_BIN )
// Split by table seprator, reverse and return the total bytes per second // Split by table seprator, reverse and return the total bytes per second
.split( "│" ) .split( "│" )
@ -91,7 +87,7 @@ function measureSize() {
glob.sync( "examples/*.pegjs" ) glob.sync( "examples/*.pegjs" )
.forEach( example => { .forEach( example => {
exec( `node ${ ef.pegjs } ${ example }` ); exec( `node ${ PEGJS_BIN } ${ example }` );
example = example.slice( 0, -5 ) + "js"; example = example.slice( 0, -5 ) + "js";
size += fs.statSync( example ).size; size += fs.statSync( example ).size;
fs.unlinkSync( example ); fs.unlinkSync( example );

Loading…
Cancel
Save