forked from sorbet/sorbet
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
Empty file.
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
# This script runs the benchmarks for the Prism parser in the Sorbet type checker. | ||
# It assumes the presence of a few directories and tools: | ||
# - The yjit-bench directory, which contains the benchmarks for YJIT (https://github.com/Shopify/yjit-bench) | ||
# - Hyperfine, a command-line benchmarking tool (https://github.com/sharkdp/hyperfine) | ||
|
||
# Check if the yjit-bench directory exists | ||
if [ ! -d "../yjit-bench" ]; then | ||
echo "Please clone the yjit-bench directory before running this script: https://github.com/Shopify/yjit-bench" | ||
exit 1 | ||
fi | ||
|
||
if [! command -v hyperfine >/dev/null 2>&1 ]; then | ||
echo "Please install hyperfine before running this script: https://github.com/sharkdp/hyperfine" | ||
exit 1 | ||
fi | ||
|
||
# Enable globstar for recursive directory listing | ||
# shopt -s globstar | ||
|
||
# Read all files in the benchmarks directory to warm up the file system cache | ||
for i in {1..10} | ||
do | ||
cat ../yjit-bench/benchmarks/**/*.rb > /dev/null | ||
done | ||
|
||
# Run the parser benchmarks | ||
# These benchmarks compare the performance of the Prism parser with the Sorbet parser without | ||
# any other parts of the type checker enabled. | ||
hyperfine \ | ||
--warmup=10 --export-json="prism_benchmarks/data/parser/$(date '+%Y-%m-%d')-$(git rev-parse --short HEAD).json" --parameter-list parser sorbet,prism \ | ||
"bazel-bin/main/sorbet --parser={parser} --stop-after=parser ../yjit-bench/benchmarks" | ||
|
||
# Run the pipeline benchmarks | ||
# These benchmarks compare the performance of the entire Sorbet type checking pipeline with | ||
# the Prism parser enabled and the Sorbet parser enabled. These benchmarks must be run on a | ||
# smaller set of files that only contain nodes supported by the Prism --> Sorbet translation layer. | ||
hyperfine \ | ||
--warmup=10 --export-json="prism_benchmarks/data/pipeline/$(date '+%Y-%m-%d')-$(git rev-parse --short HEAD).json" --parameter-list parser sorbet,prism \ | ||
"bazel-bin/main/sorbet --parser={parser} test/prism_regression" |