| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. Signed-off-by: Jeremy Yallop <yallop@docker.com>
|
What about fs.realPath()? |
Sorry, something went wrong.
We removed the cache argument in v6. The cache in fs.realpathSync is exlusively used by the module loader now, not part of a public API. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM with green CI
CI: https://ci.nodejs.org/job/node-test-commit/6630/
CITGM: https://ci.nodejs.org/view/Node.js-citgm/job/citgm-smoker/479/
Sorry, something went wrong.
|
Thanks for the reviews. I'm not sure why the test/arm CI failed, but let me know if there's anything more I need to do here. |
Sorry, something went wrong.
|
CI 2: https://ci.nodejs.org/job/node-test-commit/6831/ (ARM failures were probably machine issues) |
Sorry, something went wrong.
|
OS X failure looks like an unrelated race condition in test-http-client-timeout-with-data to me but let's re-run CI to confirm... |
Sorry, something went wrong.
|
Hmmm, now an AIX failure, also seemingly unrelated. Peculiar. Let's try again: |
Sorry, something went wrong.
|
There we go. CI is ✅ |
Sorry, something went wrong.
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. PR-URL: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. PR-URL: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. PR-URL: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
|
I've gone ahead and backported to v6.x, but am a little bit wary. Is this a good change to backport? It did not land cleanly on v4.x, which makes sense to me. As such I added the appropriate don't land label |
Sorry, something went wrong.
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. PR-URL: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. PR-URL: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. PR-URL: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Notable Changes: The SEMVER-MINOR changes include: * crypto: allow adding extra certs to well-known CAs (Sam Roberts) #9139 * deps: Upgrade INTL ICU to version 58 (Steven R. Loomis) #9234 * process: add `process.memoryUsage.external` (Fedor Indutny) #9587 * src: add wrapper for process.emitWarning() (Sam Roberts) #9139 Notable SEMVER-PATCH changes include: * fs: cache non-symlinks in realpathSync. (Jeremy Yallop) #10253 * repl: allow autocompletion for scoped packages (Evan Lucas) #10296
Notable Changes: The SEMVER-MINOR changes include: * crypto: allow adding extra certs to well-known CAs (Sam Roberts) #9139 * deps: Upgrade INTL ICU to version 58 (Steven R. Loomis) #9234 * process: add `process.memoryUsage.external` (Fedor Indutny) #9587 * src: add wrapper for process.emitWarning() (Sam Roberts) #9139 Notable SEMVER-PATCH changes include: * fs: cache non-symlinks in realpathSync. (Jeremy Yallop) #10253 * repl: allow autocompletion for scoped packages (Evan Lucas) #10296 PR-URL: #10974
Notable Changes:
The SEMVER-MINOR changes include:
* crypto: allow adding extra certs to well-known CAs (Sam Roberts)
nodejs/node#9139
* deps: Upgrade INTL ICU to version 58 (Steven R. Loomis)
nodejs/node#9234
* process: add `process.memoryUsage.external` (Fedor Indutny)
nodejs/node#9587
* src: add wrapper for process.emitWarning() (Sam Roberts)
nodejs/node#9139
Notable SEMVER-PATCH changes include:
* fs: cache non-symlinks in realpathSync. (Jeremy Yallop)
nodejs/node#10253
* repl: allow autocompletion for scoped packages (Evan Lucas)
nodejs/node#10296
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
Notable Changes:
The SEMVER-MINOR changes include:
* crypto: allow adding extra certs to well-known CAs (Sam Roberts)
nodejs/node#9139
* deps: Upgrade INTL ICU to version 58 (Steven R. Loomis)
nodejs/node#9234
* process: add `process.memoryUsage.external` (Fedor Indutny)
nodejs/node#9587
* src: add wrapper for process.emitWarning() (Sam Roberts)
nodejs/node#9139
Notable SEMVER-PATCH changes include:
* fs: cache non-symlinks in realpathSync. (Jeremy Yallop)
nodejs/node#10253
* repl: allow autocompletion for scoped packages (Evan Lucas)
nodejs/node#10296
Signed-off-by: Ilkka Myller <ilkka.myller@nodefield.com>
| Back | FazBrowse Home | New Git URL |
Background
The fs.realpathSync function synchronously traverses paths componentwise to resolve symbolic links.
The optional cache argument stores the results of resolution to avoid repeated lookups. The cache can be used to override resolution and to store the results of calls to readlinkSync.
However, the cache only records paths that lstat reveals to be symlinks. Consequently, a call to fs.realpathSync for a path without symlinks may result in many calls to lstat, even if most parts of the path have been resolved in an earlier call.
Checklist
Affected core subsystem(s)
fs
Description of change
This tiny patch extends fs.realpathSync to record the results for paths that are not symlinks. The code suggests that this was originally the intention, since the cache is expected to contain entries that resolve to themselves:
With this patch a run of ember build on a fresh application makes around 6,200 fewer lstat calls (out of a total of around 70,000 syscalls). On a typical native file system the performance difference is negligible, but in situations where a syscall has more significant overhead it can be a worthwhile saving. For example, with a file system that forwards operations over a socket via FUSE this patch saves around 10% of the build time.