-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add backend selection to fasteffekt, add verbose logging flag, refact…
…or commandline app more cleaning up js runner and fixing bugs improve error logging when benchmarks fail
- Loading branch information
Showing
2 changed files
with
120 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,67 @@ | ||
#!/usr/bin/env node | ||
|
||
const { verify } = require('crypto'); | ||
const {verify} = require('crypto'); | ||
const path = require('path'); | ||
const runAll = require("./compare/comparator") | ||
|
||
const arg = process.argv.length > 2 ? process.argv[2].toLowerCase() : "" | ||
const isHelp = (arg == "--help" || arg == "-h") | ||
const knownBackends = ["js", "chez-lift", "llvm", "ml"]; | ||
const passedArguments = { | ||
help: false, | ||
backend: "js", | ||
isVerify: false, | ||
version: false, | ||
verbose: false | ||
}; | ||
|
||
if (isHelp) { | ||
console.log(` | ||
process.argv.slice(2).map(p => p.toLowerCase()).forEach(arg => { | ||
if (arg == "--help" || arg == "-h") { | ||
passedArguments.help = true; | ||
} else if (arg.startsWith("--backend=")) { | ||
const arr = arg.split("="); | ||
if (arr.length == 2 && knownBackends.findIndex(p => p == arr[1]) != -1) { | ||
passedArguments.backend = arr[1]; | ||
return; | ||
} | ||
throw new Error(`backend parameter is incorrect. must be --backend=js or one of \n${knownBackends.join("\t")}`) | ||
} else if (arg == "--small" || arg == "-s") { | ||
passedArguments.isVerify = true; | ||
} else if (arg == "--version" || arg == "-v") { | ||
passedArguments.version = true; | ||
} else if (arg == "--verbose") { | ||
passedArguments.verbose = true; | ||
} else { | ||
throw new Error(`can not parse argument: ${arg}`) | ||
} | ||
}) | ||
|
||
|
||
if (passedArguments.help) { | ||
console.log(` | ||
fasteffekt - by Maximilian Marschall | ||
benchmarking the current install of the effekt language. | ||
will execute benchmarks in effekt and JS. | ||
outputs results to console and JSON file | ||
execute all benchmarks: fasteffekt [--small] | ||
execute all benchmarks: fasteffekt [--small] [backend] | ||
run with: | ||
options: | ||
--help, -h: documentation | ||
--small, -s: run minimal benchmark to verify they all work | ||
--version, -v: show version of fasteffekt | ||
--verbose verbose logging | ||
backend: which effekt backend to use. defaults to JS. passed directly to effekt.sh | ||
`) | ||
} else if (arg == "--version" || arg == "-v") { | ||
const packageJson = require('../../package.json'); | ||
// Access the version field and log it | ||
console.log('Package version:', packageJson.version); | ||
} else if (passedArguments.version) { | ||
const packageJson = require('../../package.json'); | ||
// Access the version field and log it | ||
console.log('Package version:', packageJson.version); | ||
} else { | ||
const isVerify = (arg == "--small" || arg == "-s") | ||
if (isVerify) | ||
console.log("verify-mode:", isVerify) | ||
runAll(isVerify ? "--verify" : "") | ||
if (passedArguments.isVerify) | ||
console.log("verify-mode:", passedArguments.isVerify) | ||
if (passedArguments.verbose) { | ||
console.log("verbose"); | ||
} | ||
console.log(`run for backend ${passedArguments.backend}`); | ||
|
||
runAll(passedArguments.isVerify ? "--verify" : "", passedArguments.backend, passedArguments.verbose); | ||
} | ||
|