summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2022-12-02 17:24:30 +0100
committerDanielle Adams <adamzdanielle@gmail.com>2023-01-04 20:31:56 -0500
commit1f4c1faf1221e4113852e149a2244427d5cac696 (patch)
treeded56ed9419495cbfba24b62f1e681bf5dc1ad3a
parent16cb2b6e4d94e7ac46398f8c192b81d5f3c4cb9b (diff)
downloadnode-new-1f4c1faf1221e4113852e149a2244427d5cac696.tar.gz
build: disable v8 snapshot compression by default
In the upstream, V8 also disables snapshot compression on the desktop by default because the size reduction is not worth the performance hit. https://chromium-review.googlesource.com/c/v8/v8/+/3275554 Locally the binary size of Node.js is increased by ~2.7MB (+3.2%) with a significant speedup in startup after snapshot compression is disabled on macOS. Also adds a --v8-enable-snapshot-compression to configure.py for users who prefer a size reduction over speedup in startup. Ideally we should implement our own compression for the source code + the code cache + the snapshot instead of relying on V8's builtin compression for just the snapshot. PR-URL: https://github.com/nodejs/node/pull/45716 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
-rwxr-xr-xconfigure.py8
-rw-r--r--tools/v8_gypfiles/features.gypi2
2 files changed, 9 insertions, 1 deletions
diff --git a/configure.py b/configure.py
index bc21faef7d..81d54a14b7 100755
--- a/configure.py
+++ b/configure.py
@@ -834,6 +834,12 @@ parser.add_argument('--v8-enable-short-builtin-calls',
help='Enable V8 short builtin calls support. This feature is enabled '+
'on x86_64 platform by default.')
+parser.add_argument('--v8-enable-snapshot-compression',
+ action='store_true',
+ dest='v8_enable_snapshot_compression',
+ default=None,
+ help='Enable the built-in snapshot compression in V8.')
+
parser.add_argument('--node-builtin-modules-path',
action='store',
dest='node_builtin_modules_path',
@@ -1535,6 +1541,8 @@ def configure_v8(o):
o['variables']['v8_enable_hugepage'] = 1 if options.v8_enable_hugepage else 0
if options.v8_enable_short_builtin_calls or o['variables']['target_arch'] == 'x64':
o['variables']['v8_enable_short_builtin_calls'] = 1
+ if options.v8_enable_snapshot_compression:
+ o['variables']['v8_enable_snapshot_compression'] = 1
if options.v8_enable_object_print and options.v8_disable_object_print:
raise Exception(
'Only one of the --v8-enable-object-print or --v8-disable-object-print options '
diff --git a/tools/v8_gypfiles/features.gypi b/tools/v8_gypfiles/features.gypi
index 022f89e565..82c95b4d6d 100644
--- a/tools/v8_gypfiles/features.gypi
+++ b/tools/v8_gypfiles/features.gypi
@@ -211,7 +211,7 @@
'v8_enable_regexp_interpreter_threaded_dispatch%': 1,
# Disable all snapshot compression.
- 'v8_enable_snapshot_compression%': 1,
+ 'v8_enable_snapshot_compression%': 0,
# Enable control-flow integrity features, such as pointer authentication
# for ARM64.