tsperf / tracer

A VSCode extension to measure type complexity within a project.
https://tsperf.dev
MIT License
157 stars 4 forks source link
performance typescript vscode vscode-extension

Type Complexity Tracer

Visual Studio Marketplace Version

A VSCode extension to measure type complexity within a project.

🚧 It is a work in progress - help is wanted! 🚧

Real-time type checking estimates

To avoid the overhead of launching a separate tsserver, it currently queries the VSCode language server to get information about tokens in an open file, and uses the timings of the responses as a proxy for the complexity of the types, following the pattern of @definitelytyped/perf.

Trace file view and metrics

The Tracer: tsc trace command can be run to gather accurate timings. As with real-time metrics, these create diagnostics in the editor open files. It also opens an interface to browse trace files. Editor and UI commands enable navigating between locations in the editor and the trace.

If the trace is run with a version of tsc that includes timestamps in types.json, type count metrics are also displayed. A PR to include these timestamps or tooling to automatically patch them in are works in progress. See https://github.com/typeholes/TypeScript/tree/trace-data-5-4 for a version you can build yourself.

Use in mono repos

Better support for mono repos is on the roadmap. For now you can run traces for packages via the context menu in the file tree

Credits

We are grateful to Algora for creating the TSPerf Type Challenge and to its sponsors.

Help wanted

License

Published under the MIT License.