From 2502a37d41e8a7f279af74d7dacc009ee1010f67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 14 Feb 2023 02:46:32 +0100 Subject: chore(build): don't compress TSC snapshot in debug build (#17772) 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. --- cli/tsc/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/tsc/mod.rs') diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs index c9ff4668a..343df71df 100644 --- a/cli/tsc/mod.rs +++ b/cli/tsc/mod.rs @@ -56,6 +56,14 @@ pub static COMPILER_SNAPSHOT: Lazy> = Lazy::new( static COMPRESSED_COMPILER_SNAPSHOT: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.bin")); + // 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)] + return COMPRESSED_COMPILER_SNAPSHOT.to_vec().into_boxed_slice(); + + #[cfg(not(debug_assertions))] zstd::bulk::decompress( &COMPRESSED_COMPILER_SNAPSHOT[4..], u32::from_le_bytes(COMPRESSED_COMPILER_SNAPSHOT[0..4].try_into().unwrap()) -- cgit v1.2.3