-
Notifications
You must be signed in to change notification settings - Fork 23
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
[PERF] switch from realpathSync -> readlinkSync #12
Conversation
@joliss has already identified nodes performance issues with realpath [here](nodejs/node-v0.x-archive#7902) As per @krisseldens suggestion, we can likely just use readlinkSync here instead. real life example: https://github.com/ember-cli/stress-app before: 8668.970928ms after: 7152.094867ms 18% incremental build improvement As realpathSync uses readlinkSync internally, this also reduces calls to readlinkSync before: 17826 (134.230726ms) after: 6171 ( 93.061130ms)
(One might be tempted to use I believe most of |
Short of a native extension (which causes portability issues) I'm not sure how to use the posix version |
It may be an option to create a faster user land variation of realpathSync. If you can provide a failing test case, it would be handy. That way I can be sure the scenario you describe is handled correctly |
Ya, I'm pretty sure we can implement a better then node's provided one, in user-space. In addition to that, if we took a similar approach as https://github.com/stefanpenner/mkdirp-bulk We could really cut down on duplicate internal stats and readlinks. |
My preferred solution would be to fix Node to call |
It's tempting to branch on absolute paths, but |
Fixing node seems fine, but that actually means months or years until our users gain access to it. I wish adding native extensions wasn't such a hazard. Someone needs to bite the bullet an fix the node side of things. So future travelers don't have to endure this. The more I think about the more I think the batching approach will likely yield the best short-term outcome for us. So I will likely explore both a faster user land variation and on top of it a batching version. |
@joliss i found https://gist.github.com/joliss/3292eda35cd4d564cdd7 i suspect this is the failing scenaro? If so i'll add it to this suite. |
Yeah that's the scenario. |
@joliss thanks |
Does it sound reasonable for us to implement both? First use In our use-cases it is fairly uncommon to hit the relative scenario (although not impossible). |
Sounds very reasonable. If you want to give it a try, note that on Windows |
Thanks for the Windows tip. I was not aware of that issue |
@joliss has already identified nodes performance issues with realpath here
As per @krisselden's suggestion, we can likely just use
readlinkSync
here instead.real life example: https://github.com/ember-cli/stress-app
before:
8668.970928ms
after:
7152.094867ms
18%
improvement to incremental buildsAs
realpathSync
usesreadlinkSync
internally, this also reduces calls toreadlinkSync
before:
17826 (134.230726ms)
after:
6171 ( 93.061130ms)