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

extract-stream: use file mapping on Windows #8

Closed
wants to merge 1 commit into from

Conversation

joaocgreis
Copy link

This makes pacote take advantage of writing files using a file mapping on Windows when available, which can be significantly faster. Support landed in libuv in libuv/libuv#2295 and in Node.js in nodejs/node#29260. This PR has no effect unless a node-tar includes isaacs/node-tar#227.

Using a file mapping is only an advantage in some situations which are hard to determine and vary widely from machine to machine. However, it is always better or similar when making a short number of writes to a file and the file is not too large (less than about 1MB). Extracting npm packages matches these conditions, and using a file mapping here seems to always be an advantage. On my tests, running npm with this change is often faster, up to almost half the time in some cases.

This PR does not include a test because the feature is always enabled and there is no API to know if a write operation was actually performed using a file mapping.

@joaocgreis
Copy link
Author

Closing in favor of isaacs/node-tar#230

@joaocgreis joaocgreis closed this Sep 21, 2019
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.

1 participant