Don't fsync every file when installing gems #556
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
d84090b introduced "similar sync behavior from old tar code". It looks like the old code was fsyncing directories, but the commit was fsyncing every single file.
This fixes a severe performance degradation in our virtualized environment. Gem install takes ~40 seconds on rubygems 2.0 compared to ~1 second on rubygems 1.8.
I looked through the last version that didn't have those performance issues - 1.8.25 - and the Gem::Package::FSyncDir module is dead code there.
I don't know rubygems well enough to say if its absolutely safe to remove this code, but from my limited testing it seems that it is. I installed a few gems with checking if any TarReader::Entry is a directory, and none of them is.