You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(fs): add lazy caching for allowed directories in safeDelete
Cache resolved allowed directories (tmpdir, cacache, socketUserDir) on
first safeDelete call to avoid re-computing them on every invocation.
These paths don't change during process lifetime, so caching provides
significant performance improvement when safeDelete is called frequently.
Benefits:
- Avoids loading os, path, and paths modules repeatedly
- Skips calling os.tmpdir(), getSocketCacacheDir(), getSocketUserDir()
- Eliminates path.resolve() calls for all 3 directories
- Applied to both safeDelete() and safeDeleteSync()
This is especially beneficial in cleanup operations that process
multiple files, such as cleanupIpcStubs() which calls safeDelete
in a Promise.all() loop.
0 commit comments