diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-02-14 02:46:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-14 02:46:32 +0100 |
commit | 2502a37d41e8a7f279af74d7dacc009ee1010f67 (patch) | |
tree | 74b4242404ea3041126af1cebb906863615a1eaa /cli/tsc | |
parent | 0f1349bca8d40dff23098e141363c956a8dd7875 (diff) |
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.
Diffstat (limited to 'cli/tsc')
-rw-r--r-- | cli/tsc/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
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<Box<[u8]>> = 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()) |