You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Optimization: cache results between TypeScript projects (#182)
* Optimization: cache results between projects
Towards #175
Previously, scip-typescript didn't cache anything at all between TypeScript projects. This commit implements an optimization so that we now cache the results of loading source files and parsing options. Benchmarks against the sourcegraph/sourcegraph repo indicate this optimization consistently speeds up the `index` command in all three multi-project repositories that I tested it with.
- sourcegraph/sourcegraph: ~30% from ~100s to ~70s
- nextautjs/next-auth: ~40% from 6.5s to 3.9
- xtermjs/xterm.js: ~45% from 7.3s to 4.1s
For every repo, I additionally validated that the resulting index.scip has identical checksum before and after applying this optimization. Given these promising results, this new optimization is enabled by default, but can be disabled with the option `--no-global-cache`.
*Test plan*
Manually tested by running `scip-typescript index tsconfig.all.json` in the sourcegraph/sourcegraph repository. To benchmark the difference for this PR:
- Checkout the code
- Run `yarn tsc -b`
- Go to the directory of your project
- Run `node PATH_TO_SCIP_TYPESCRIPT/dist/src/main.js`
- Copy the "optimized" index.scip with `cp index.scip index-withcache.scip`
- Run `node PATH_TO_SCIP_TYPESCRIPT/dist/src/main.js --no-global-caches`
- Validate the checksum is identical from the optimized output `shasum -a 256 *.scip`
* Fix failing tests
* Address review comments
0 commit comments