summaryrefslogtreecommitdiff
path: root/src/node_internals.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-12-03 21:47:57 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2018-12-18 18:02:11 +0800
commit0858e5d9d8db085cb83b3f1f3f94ed6b550a7bc5 (patch)
tree23855a4a96c3101d99a121c9ff158b9bea912708 /src/node_internals.h
parentceb66352236240498a9263500c7bde74e58c71fa (diff)
downloadandroid-node-v8-0858e5d9d8db085cb83b3f1f3f94ed6b550a7bc5.tar.gz
android-node-v8-0858e5d9d8db085cb83b3f1f3f94ed6b550a7bc5.tar.bz2
android-node-v8-0858e5d9d8db085cb83b3f1f3f94ed6b550a7bc5.zip
src: always compile and store code cache for native modules
This patch changes the NativeModuleLoader to always try to find code cache for native modules when it compiles them, and always produce and store the code cache after compilation. The cache map is protected by a mutex and can be accessed by different threads - including the worker threads and the main thread. Hence any thread can reuse the code cache if the native module has already been compiled by another thread - in particular the cache of the bootstrappers and per_context.js will always be hit when a new thread is spun. This results in a ~6% startup overhead in the worst case (when only the main thread is launched without requiring any additional native module - it now needs to do the extra work of finding and storing caches), which balances out the recent improvements by moving the compilation to C++, but it also leads to a ~60% improvement in the best case (when a worker thread is spun and requires a lot of native modules thus hitting the cache compiled by the main thread). PR-URL: https://github.com/nodejs/node/pull/24950 Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_internals.h')
-rw-r--r--src/node_internals.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/src/node_internals.h b/src/node_internals.h
index 6fe1d9a80a..d9a72a10a4 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -91,7 +91,6 @@ extern bool v8_initialized;
extern Mutex per_process_opts_mutex;
extern std::shared_ptr<PerProcessOptions> per_process_opts;
-extern native_module::NativeModuleLoader per_process_loader;
// Forward declaration
class Environment;