Skip to content

Commit 03db415

Browse files
joyeecheungtargos
authored andcommitted
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: #45716 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Daeyeon Jeong <[email protected]>
1 parent 924f6ab commit 03db415

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

configure.py

+8
Original file line numberDiff line numberDiff line change
@@ -805,6 +805,12 @@
805805
help='Enable V8 short builtin calls support. This feature is enabled '+
806806
'on x86_64 platform by default.')
807807

808+
parser.add_argument('--v8-enable-snapshot-compression',
809+
action='store_true',
810+
dest='v8_enable_snapshot_compression',
811+
default=None,
812+
help='Enable the built-in snapshot compression in V8.')
813+
808814
parser.add_argument('--node-builtin-modules-path',
809815
action='store',
810816
dest='node_builtin_modules_path',
@@ -1482,6 +1488,8 @@ def configure_v8(o):
14821488
o['variables']['v8_enable_hugepage'] = 1 if options.v8_enable_hugepage else 0
14831489
if options.v8_enable_short_builtin_calls or o['variables']['target_arch'] == 'x64':
14841490
o['variables']['v8_enable_short_builtin_calls'] = 1
1491+
if options.v8_enable_snapshot_compression:
1492+
o['variables']['v8_enable_snapshot_compression'] = 1
14851493
if options.v8_enable_object_print and options.v8_disable_object_print:
14861494
raise Exception(
14871495
'Only one of the --v8-enable-object-print or --v8-disable-object-print options '

tools/v8_gypfiles/features.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
'v8_enable_regexp_interpreter_threaded_dispatch%': 1,
217217

218218
# Disable all snapshot compression.
219-
'v8_enable_snapshot_compression%': 1,
219+
'v8_enable_snapshot_compression%': 0,
220220

221221
# Enable control-flow integrity features, such as pointer authentication
222222
# for ARM64.

0 commit comments

Comments
 (0)