summaryrefslogtreecommitdiff
path: root/cli/build.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/build.rs')
-rw-r--r--cli/build.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/build.rs b/cli/build.rs
index 251b30de2..ecd7ed1be 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -270,7 +270,22 @@ mod ts {
build_libs,
path_dts,
)],
+
+ // NOTE(bartlomieju): Compressing the TSC snapshot in debug build took
+ // ~45s on M1 MacBook Pro; without compression it took ~1s.
+ // Thus we're not not using compressed snapshot, trading off
+ // a lot of build time for some startup time in debug build.
+ #[cfg(debug_assertions)]
compression_cb: None,
+
+ #[cfg(not(debug_assertions))]
+ compression_cb: Some(Box::new(|vec, snapshot_slice| {
+ eprintln!("Compressing TSC snapshot...");
+ vec.extend_from_slice(
+ &zstd::bulk::compress(snapshot_slice, 22)
+ .expect("snapshot compression failed"),
+ );
+ })),
snapshot_module_load_cb: None,
});
}