Created
October 7, 2023 20:49
-
-
Save zamazan4ik/cfb92461913f517de3005235ad4cb173 to your computer and use it in GitHub Desktop.
Tweaked performance.sh
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
#!/usr/bin/env bash | |
REPORT=$(pwd)/PERFORMANCE.md | |
PERFORMANCE_TMP_DIR=$(pwd)/performance_tmp | |
MD_FILES="$PERFORMANCE_TMP_DIR/"*".md" | |
LARGE_JSON_FILE=$(pwd)/github-repositories.json | |
MIN_RUNS=1000 | |
# Remove export file if present. | |
rm -f $REPORT | |
# Create the directory. | |
mkdir $PERFORMANCE_TMP_DIR | |
# Run the benchmarks. | |
hyperfine \ | |
--export-markdown "$PERFORMANCE_TMP_DIR/OBJECT.md" \ | |
--min-runs $MIN_RUNS \ | |
"echo '{ \"foo\": \"bar\" }' | ./jql_z '\"foo\"'" \ | |
"echo '{ \"foo\": \"bar\" }' | ./jql_opt_3 '\"foo\"'" \ | |
"echo '{ \"foo\": \"bar\" }' | ./jql_optimized '\"foo\"'" | |
hyperfine \ | |
--export-markdown "$PERFORMANCE_TMP_DIR/ARRAY_INDEX.md" \ | |
--min-runs $MIN_RUNS \ | |
"echo '[1, 2, 3]' | ./jql_z '[0]'" \ | |
"echo '[1, 2, 3]' | ./jql_opt_3 '[0]'" \ | |
"echo '[1, 2, 3]' | ./jql_optimized '[0]'" | |
hyperfine \ | |
--export-markdown "$PERFORMANCE_TMP_DIR/ARRAY_FLATTEN.md" \ | |
--min-runs $MIN_RUNS \ | |
"echo '[1, [2], [[3]]]' | ./jql_z '..'" \ | |
"echo '[1, [2], [[3]]]' | ./jql_opt_3 '..'" \ | |
"echo '[1, [2], [[3]]]' | ./jql_optimized '..'" | |
hyperfine \ | |
--export-markdown "$PERFORMANCE_TMP_DIR/PROPERTY_SELECTION_LARGE_JSON.md" \ | |
--min-runs $MIN_RUNS \ | |
"cat $LARGE_JSON_FILE | ./jql_z '|>{\"name\", \"url\", \"language\", \"stargazers_count\", \"watchers_count\"}' > /dev/null" \ | |
"cat $LARGE_JSON_FILE | ./jql_opt_3 '|>{\"name\", \"url\", \"language\", \"stargazers_count\", \"watchers_count\"}' > /dev/null" \ | |
"cat $LARGE_JSON_FILE | ./jql_optimized '|>{\"name\", \"url\", \"language\", \"stargazers_count\", \"watchers_count\"}' > /dev/null" | |
# Merge all the markdown files into the performance one. | |
for md_file in $MD_FILES; do (cat "${md_file}"; echo) >> $REPORT; done | |
# Remove the directory. | |
rm -R -f $PERFORMANCE_TMP_DIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment