This repository offers a simple setup for benchmarking your ReScript projectcompilation metrics.
It's very simple for now:
The scriptbenchmark-test.js will automatically pick up your bsconfig.sourcesconfiguration to find all.re file occurrences and puts it in relation tothe ReScript compiler build times by running a clean build.
It will not measure complete builds (no -clean-world | -make-world) to keepdependencies out of the equation.
node benchmark-test.js > result.json
The script outputs pure json onstdout, and some human readable informationonstderr. Example output:
node scripts/benchmark-test.jsCapturing LOC / file numbers...Cleaning the project first...Measuring build performance...{ "fileMetrics": { "numberOfFiles": 37, "blankLines": 483, "commentLines": 177, "codeLines": 4510, "totalLines": 5170 }, "buildTime": { "real": 3.12, "user": 4.18, "sys": 1.77 }, "results": { "locPerSec": 1237 }}
It's a standalone NodeJS script, it only needs a typical ReScript project with absconfig.json in its project root andcloc as a dev dependency:
# Install line counting toolnpm install cloc --save-dev# Create some subdir if wantedmkdir scripts# Curl the test script into the scripts foldercurl -o scripts/benchmark-test.js https://raw.githubusercontent.com/ryyppy/re-compiler-benchmark-tool/master/benchmark-test.js# Make sure to make world before running the tool, otherwise it will failnpx bsb -make-world# To run itnode scripts/benchmark-test.js
It's a simple script