Created
October 26, 2022 04:25
-
-
Save jakebailey/362aedfb19bff6086585509e223b7a64 to your computer and use it in GitHub Desktop.
TypeScript entrypoint startup time benchmark
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/zsh | |
# Make sure that our branch-switch checks below don't skip the build. | |
git switch main >& /dev/null | |
npm ci >& /dev/null | |
gulp clean >& /dev/null | |
gulp local >& /dev/null | |
function bench() { | |
name=$1 | |
command=$2 | |
hyperfine \ | |
--shell zsh \ | |
--warmup 100 \ | |
--runs 1000 \ | |
--command-name "$name main" \ | |
--prepare 'git switch main |& grep -q "Already" || (npm ci && gulp clean && gulp local)' \ | |
$command \ | |
--command-name "$name module-ified" \ | |
--prepare 'git switch typeformer-2 |& grep -q "Already" || (npm ci && gulp clean && gulp local)' \ | |
$command | |
} | |
bench "tsc" "node ./built/local/tsc.js --version" | |
bench "tsserver" "echo '{\"seq\": 1, \"command\": \"exit\"}' | node ./built/local/tsserver.js --disableAutomaticTypingAcquisition" | |
bench "typescript" "node ./built/local/typescript.js" | |
bench "tsserverlibrary" "node ./built/local/tsserverlibrary.js" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment