Skip to content

Commit cc594dd

Browse files
Updated Performance (markdown)
1 parent a67883c commit cc594dd

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

Performance.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -624,15 +624,22 @@ Upgrading to a newer version of TypeScript (which can be more efficient) or to a
624624

625625
In some cases, the approaches above might not give you enough insight to understand why TypeScript feels slow.
626626
TypeScript 4.1 and higher provides a `--generateTrace` option that can give you a sense of the work the compiler is spending time on.
627-
`--generateTrace` will create an output file that can be analyzed within Edge or Chrome.
627+
`--generateTrace` will create an output file that can be analyzed by the `@typescript/analyze-trace` utility, or within Edge or Chrome.
628628

629629
Ideally, TypeScript will be able to compile your project without any errors, though it's not a strict requirement for tracing.
630+
630631
Once you're ready to get a trace, you can run TypeScript with the `--generateTrace` flag.
631632

632633
```
633634
tsc -p ./some/project/src/tsconfig.json --generateTrace tracing_output_folder
634635
```
635636

637+
In some cases, you can also take a trace from your editor. In Visual Studio Code, that can be toggled by setting `TypeScript > Tsserver: Enable Tracing` in the UI or adding the following JSON setting:
638+
639+
```json5
640+
"typescript.tsserver.enableTracing": true,
641+
```
642+
636643
To quickly list performance hot-spots, you can install and run [@typescript/analyze-trace](https://www.npmjs.com/package/@typescript/analyze-trace) from npm.
637644

638645
Alternatively, you can review the details manually:
@@ -641,7 +648,7 @@ Alternatively, you can review the details manually:
641648
1. Click on the `Load` button at the top left,
642649
1. Open the generated JSON file (`trace.*.json`) in your output directory.
643650

644-
Note that, even if your build doesn't directly invoke tsc (e.g. because you use a bundler) or the slowdown you're seeing is in the editor, collecting and interpreting a trace from tsc will generally be much easier than trying to investigate your slowdown directly and will still produce representative results.
651+
Note that, even if your build doesn't directly invoke `tsc` (e.g. because you use a bundler) or the slowdown you're seeing is in the editor, collecting and interpreting a trace from `tsc` will generally be much easier than trying to investigate your slowdown directly and will still produce representative results.
645652

646653
You can [read more about performance tracing in more detail here](https://github.com/microsoft/TypeScript/wiki/Performance-Tracing).
647654

0 commit comments

Comments
 (0)