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

Caching the results of path.relative reduces rebuild times #1543

Closed
ashaffer opened this issue Apr 13, 2016 · 5 comments
Closed

Caching the results of path.relative reduces rebuild times #1543

ashaffer opened this issue Apr 13, 2016 · 5 comments

Comments

@ashaffer
Copy link
Member

I did a bit of profiling with devtool and noticed that a bunch of time is spent in path.relative during rebuilds, for the most part repeating path resolutions that have already been done.

Memoizing it's results decreases my rebuild times by about 10%. I made a little module for shimming path.relative to make this happen, cached-path-relative. But maybe it'd be best to have browserify and its dependencies use this or something like it explicitly?

@terinjokes
Copy link
Contributor

I love when 🔍 happens 😄 .

Other than removing the repeated relative lookups entirely, I don't see why we wouldn't want to cache these. I can see a problem is a symlink changes, but Browserify doesn't have a great record with those already. 😞

Where would this make the most impact in your builds? Here in browserify, or in one of the dependencies?

@ashaffer
Copy link
Member Author

The big ones seem to be here in browserify and in module-deps. And ya, devtool is pretty awesome for this sort of profiling.

@terinjokes
Copy link
Contributor

PR? 😀

@ashaffer
Copy link
Member Author

Sure, i'll try to put something together tonight.

@ghost
Copy link

ghost commented Oct 22, 2016

Great work everyone. Released in 13.1.1.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants