Skip to content
This repository has been archived by the owner on May 4, 2024. It is now read-only.

20% npm install speedup: cache extras by package.json string #70

Closed
wants to merge 1 commit into from

Conversation

mikesherov
Copy link
Contributor

@mikesherov mikesherov commented Jun 20, 2017

TL:DR

~20% speed up in the average npm install run when combined with npm/hosted-git-info#24

Details

This package used to actually cache package.json lookups, until b746f65 which was an attempt to fix npm/npm#7074 Deleting the caching mechanism definitely helped fix a correctness issue, but threw the baby out with the bath water. This PR introduces a less aggressive cache by caching by the true cache key, which is the string contents of a package.json file. Should be 100% safe to cache results based on this... I believe.

This lets us speed up builds quite a bit!

Before:

added 1764 packages in 51.943s
added 1764 packages in 51.135s
added 1764 packages in 50.688s
added 1764 packages in 52.048s
added 1764 packages in 52.156s
added 1764 packages in 54.817s

After

added 1764 packages in 42.428s
added 1764 packages in 45.116s
added 1764 packages in 42.085s

Let me know if you have any questions

@mikesherov mikesherov changed the title cache extras by package.json string 20% npm install speedup: cache extras by package.json string Jun 20, 2017
@iarna
Copy link
Contributor

iarna commented Jun 26, 2017

This was merged into v2.0.7 as 839b56e. Thank you so much! =)

@iarna iarna closed this Jun 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants