Skip to content

Commit

Permalink
tracing: skipping scope-manager's populateGlobalsFromLib
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jul 18, 2024
1 parent 9d651f6 commit c6b5fda
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 5 deletions.
35 changes: 30 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,38 @@ The `traces/` directory contains more specific traces for investigations.

> ✨ You might consider using [0x](https://github.com/davidmarkclements/0x) for nice flamegraph visuals.
All comparisons were run on a common shape of linting: 1024 files with the "even" (triangle-shaped) imports layout.

### Comparison: Globals in Scopes

> 📌 Filed on typescript-eslint as [⚡ Performance: Overhead of populateGlobalsFromLib in scope-manager](https://github.com/typescript-eslint/typescript-eslint/issues/9575).
This trace shows the impact of `@typescript-eslint/scope-manager`'s `populateGlobalsFromLib`.

See `traces/globals-scope-manager/`:

- `baseline.cpuprofile`: Baseline measurement with no changes
- `skipping.cpuprofile`: Commenting out the contents of `populateGlobalsFromLib`

They were generated with:

```shell
cd files-1024-layout-even-singlerun-true-types-service
node --cpu-prof --cpu-prof-interval=100 --cpu-prof-name=baseline.cpuprofile ../../node_modules/eslint/bin/eslint.js
# clear ../../node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js > populateGlobalsFromLib
node --cpu-prof --cpu-prof-interval=100 --cpu-prof-name=skipping.cpuprofile ../../node_modules/eslint/bin/eslint.js
```

Hyperfine measurements show a ~20% improvement in lint time:

| Variant | Measurement | User Time |
| -------- | ----------------- | --------- |
| Baseline | 3.137 s ± 0.024 s | 4.417 s |
| Caching | 2.477 s ± 0.014 s | 3.501 s |

### Comparison: Project and Project Service

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

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

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

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

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

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

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

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

Expand Down
1 change: 1 addition & 0 deletions traces/globals-scope-manager/baseline.cpuprofile

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions traces/globals-scope-manager/skipping.cpuprofile

Large diffs are not rendered by default.

0 comments on commit c6b5fda

Please sign in to comment.