Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a cache to file path mapping #1228

Merged
merged 6 commits into from
Dec 31, 2020

Conversation

berickson1
Copy link
Contributor

@berickson1 berickson1 commented Dec 29, 2020

This greatly reduces the time needed to resolve FilePathKey objects on watch builds. (~20% from 20s to 16s)

Note: The only case where I could see this optimization performing poorly is if a symlink was changed between builds, but I don't believe webpack handles that gracefully anyways.

Relates to #1215

See the performance traces below:

Before:
Screen Shot 2020-12-29 at 1 25 50 PM
Screen Shot 2020-12-29 at 1 26 01 PM

After:
Screen Shot 2020-12-29 at 1 35 58 PM
Screen Shot 2020-12-29 at 1 36 14 PM

This greatly reduces the time needed to resolve FilePathKey objects on watch builds.
@johnnyreilly
Copy link
Member

Haha - nice visuals! Did you make those by following the debugging instructions here: https://github.com/TypeStrong/ts-loader/blob/master/CONTRIBUTING.md#debugging-ts-loader-installed-from-npm-in-your-own-webpack-project ? Or was it something else?

src/instances.ts Outdated Show resolved Hide resolved
src/instances.ts Outdated Show resolved Hide resolved
@johnnyreilly
Copy link
Member

I've one naming nit but otherwise this LGTM. Do you want to add an entry to the CHANGELOG.md and increment the package.json please?

@berickson1
Copy link
Contributor Author

Haha - nice visuals! Did you make those by following the debugging instructions here: https://github.com/TypeStrong/ts-loader/blob/master/CONTRIBUTING.md#debugging-ts-loader-installed-from-npm-in-your-own-webpack-project ? Or was it something else?

Oh neat, I didn't realize that you had debugging instructions anywhere. I used a combination of node --inspect and ndb to profile and do some initial investigations

@johnnyreilly
Copy link
Member

Yeah I think @andrewbranch put the debug instructions together. Looking at this PR makes me think it would be great to have some perf testing instructions as well... Could you share what your workflow looked like to produce the above?

@berickson1
Copy link
Contributor Author

Yeah I think @andrewbranch put the debug instructions together. Looking at this PR makes me think it would be great to have some perf testing instructions as well... Could you share what your workflow looked like to produce the above?

Added in #1230

@johnnyreilly johnnyreilly merged commit e160564 into TypeStrong:master Dec 31, 2020
@berickson1 berickson1 deleted the filePathCache branch December 31, 2020 06:19
@johnnyreilly
Copy link
Member

This was referenced Mar 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants