summaryrefslogtreecommitdiff
path: root/lib/internal/bootstrap
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-04-14 17:34:08 +0200
committerRuben Bridgewater <ruben@bridgewater.de>2019-04-26 18:43:11 +0200
commit1d022e825356dfba9bef2d6f194b9e93d63b726d (patch)
treeb102789e5cdf7c399596b96e3818cbff96f62e89 /lib/internal/bootstrap
parent55147d7d9939cce1bbc2c8a70ac7ebe03e91e5cf (diff)
downloadandroid-node-v8-1d022e825356dfba9bef2d6f194b9e93d63b726d.tar.gz
android-node-v8-1d022e825356dfba9bef2d6f194b9e93d63b726d.tar.bz2
android-node-v8-1d022e825356dfba9bef2d6f194b9e93d63b726d.zip
process: improve cwd performance
This caches the current working directory and only updates the variable if `process.chdir()` is called. PR-URL: https://github.com/nodejs/node/pull/27224 Reviewed-By: John-David Dalton <john.david.dalton@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'lib/internal/bootstrap')
-rw-r--r--lib/internal/bootstrap/node.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js
index 65b9c403af..69fe4be266 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -73,6 +73,7 @@ if (isMainThread) {
const wrapped = mainThreadSetup.wrapProcessMethods(rawMethods);
process.umask = wrapped.umask;
process.chdir = wrapped.chdir;
+ process.cwd = wrapped.cwd;
// TODO(joyeecheung): deprecate and remove these underscore methods
process._debugProcess = rawMethods._debugProcess;
@@ -86,11 +87,11 @@ if (isMainThread) {
process.abort = workerThreadSetup.unavailable('process.abort()');
process.chdir = workerThreadSetup.unavailable('process.chdir()');
process.umask = wrapped.umask;
+ process.cwd = rawMethods.cwd;
}
// Set up methods on the process object for all threads
{
- process.cwd = rawMethods.cwd;
process.dlopen = rawMethods.dlopen;
process.uptime = rawMethods.uptime;