Skip to content

Instantly share code, notes, and snippets.

@MichaelDimmitt
Last active December 3, 2024 16:33
Show Gist options
  • Save MichaelDimmitt/e8a04a4a835ed6ac7447927a424e48c0 to your computer and use it in GitHub Desktop.
Save MichaelDimmitt/e8a04a4a835ed6ac7447927a424e48c0 to your computer and use it in GitHub Desktop.
typescript performance lsp experiments

Status: Test has not been completed.

Things to test, to learn how to speed up a typescript lsp.

If config file is at root of project:

  1. only open the folders that you will be working in for your editor.
    is it smart enough to know to only check that folder?
  2. does number of files open in the editor matter?
  3. does it matter if you have multiple config files? (one in each folder)

a. The test ... make a significantly annoying typescript project.
b. run the experiments.

Report findings here: https://news.ycombinator.com/item?id=25199070

https://github.com/microsoft/TypeScript-wiki/blob/main/Performance-Tracing.md

{ # how to find hotspots (low performant types in your codebase)
rm -rf tracing_output_folder; 
npx tsc -p tsconfig.json --generateTrace tracing_output_folder; 
npx @typescript/analyze-trace tracing_output_folder;
}

Related links:

  1. https://news.ycombinator.com/item?id=25199070
  2. https://www.reddit.com/r/typescript/comments/xzy20q/how_to_find_the_type_that_is_causing_performance/

This is an "infer from usage test"

@MichaelDimmitt
Copy link
Author

@MichaelDimmitt
Copy link
Author

MichaelDimmitt commented Dec 3, 2024

TypeScream

vscode extension that tells you if file took longer than threshold to run.
Or npm script on a commit hook that kills the process and tells you it is failing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment