Skip to content

Commit 13c6c79

Browse files
tracing: skipping scope-manager's populateGlobalsFromLib
1 parent 9d651f6 commit 13c6c79

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

README.md

+30-5
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,38 @@ The `traces/` directory contains more specific traces for investigations.
6464

6565
> ✨ You might consider using [0x](https://github.com/davidmarkclements/0x) for nice flamegraph visuals.
6666
67+
All comparisons were run on a common shape of linting: 1024 files with the "even" (triangle-shaped) imports layout.
68+
69+
### Comparison: Globals in Scopes
70+
71+
> 📌 Filed on typescript-eslint as [⚡ Performance: Overhead of populateGlobalsFromLib in scope-manager](https://github.com/typescript-eslint/typescript-eslint/issues/9575).
72+
73+
This trace shows the impact of `@typescript-eslint/scope-manager`'s `populateGlobalsFromLib`.
74+
75+
See `traces/globals-scope-manager/`:
76+
77+
- `baseline.cpuprofile`: Baseline measurement with no changes
78+
- `skipping.cpuprofile`: Commenting out the contents of `populateGlobalsFromLib`
79+
80+
They were generated with:
81+
82+
```shell
83+
cd files-1024-layout-even-singlerun-true-types-service
84+
node --cpu-prof --cpu-prof-interval=100 --cpu-prof-name=baseline.cpuprofile ../../node_modules/eslint/bin/eslint.js
85+
# clear ../../node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js > populateGlobalsFromLib
86+
node --cpu-prof --cpu-prof-interval=100 --cpu-prof-name=skipping.cpuprofile ../../node_modules/eslint/bin/eslint.js
87+
```
88+
89+
Hyperfine measurements show a ~20% improvement in lint time:
90+
91+
| Variant | Measurement | User Time |
92+
| -------- | ----------------- | --------- |
93+
| Baseline | 3.137 s ± 0.024 s | 4.417 s |
94+
| Skipping | 2.477 s ± 0.014 s | 3.501 s |
95+
6796
### Comparison: Project and Project Service
6897

69-
This is a preliminary trace to start debugging.
70-
It was run a common shape of linting: 1024 files with the "even" (triangle-shaped) imports layout.
98+
This is a preliminary trace to start debugging their differences.
7199

72100
See `traces/Project 1 - Service 2.cpuprofile`.
73101

@@ -95,7 +123,6 @@ Comparing equivalent code paths:
95123
> 📌 Filed on TypeScript as [⚡ Performance: Project service spends excess time cleaning client files when called synchronously](https://github.com/microsoft/TypeScript/issues/59335).
96124
97125
This comparison shows the cost of the TypeScript project service calling `cleanupProjectsAndScriptInfos`.
98-
It also was run on a common shape of linting: 1024 files with the "even" (triangle-shaped) imports layout.
99126

100127
See `traces/service-file-cleanup/`:
101128

@@ -123,7 +150,6 @@ Hyperfine measurements show a ~15-20% improvement in lint time:
123150
> 📌 Filed on TypeScript as [⚡ Performance: Project service doesn't cache all fs.statSync](https://github.com/microsoft/TypeScript/issues/59338).
124151
125152
This comparison shows the cost uncached `fs.statSync` calls inside the project service.
126-
It also was run on a common shape of linting: 1024 files with the "even" (triangle-shaped) imports layout.
127153

128154
See `traces/service-uncached-stats/`:
129155

@@ -180,7 +206,6 @@ Hyperfine measurements show a ~7-12% improvement in lint time:
180206
> 📌 Filed on TypeScript as [⚡ Performance: Project service doesn't cache all fs.realpath](https://github.com/microsoft/TypeScript/issues/59342).
181207
182208
This comparison shows the cost uncached `fs.realpath` calls inside the project service.
183-
It also was run on a common shape of linting: 1024 files with the "even" (triangle-shaped) imports layout.
184209

185210
See `traces/service-uncached-realpaths/`:
186211

traces/globals-scope-manager/baseline.cpuprofile

+1
Large diffs are not rendered by default.

traces/globals-scope-manager/skipping.cpuprofile

+1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)