summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-03-21 18:53:46 +0100
committerGitHub <noreply@github.com>2023-03-21 17:53:46 +0000
commit0d27de943a60f5ca60e2116648719c235163361a (patch)
tree6c33d632db58846ebd15e7c89bff930a691058e4 /cli
parent2ef8269fdb395b0736153ff5fbb9696cbb976e42 (diff)
perf: disable TSC snapshot compression (#18333)
This commit disables compression of the TSC snapshot. The compression only decreased the size of snapshot by 0.5Mb and it took about 40s during release build to compress. With recent gains in TS 5.0 upgrade in terms of size and performance it makes sense to remove this compression.
Diffstat (limited to 'cli')
-rw-r--r--cli/Cargo.toml2
-rw-r--r--cli/build.rs15
-rw-r--r--cli/tsc/mod.rs28
3 files changed, 3 insertions, 42 deletions
diff --git a/cli/Cargo.toml b/cli/Cargo.toml
index f9214c999..11110a78f 100644
--- a/cli/Cargo.toml
+++ b/cli/Cargo.toml
@@ -32,7 +32,6 @@ deno_core = { workspace = true, features = ["include_js_files_for_snapshotting"]
regex.workspace = true
serde.workspace = true
serde_json.workspace = true
-zstd.workspace = true
glibc_version = "0.1.2"
[target.'cfg(windows)'.build-dependencies]
@@ -106,7 +105,6 @@ twox-hash = "=1.6.3"
typed-arena = "=2.0.1"
uuid = { workspace = true, features = ["serde"] }
walkdir = "=2.3.2"
-zstd.workspace = true
[target.'cfg(windows)'.dependencies]
fwdansi.workspace = true
diff --git a/cli/build.rs b/cli/build.rs
index ecd7ed1be..251b30de2 100644
--- a/cli/build.rs
+++ b/cli/build.rs
@@ -270,22 +270,7 @@ 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,
});
}
diff --git a/cli/tsc/mod.rs b/cli/tsc/mod.rs
index 43fccb37e..60ef1c5d6 100644
--- a/cli/tsc/mod.rs
+++ b/cli/tsc/mod.rs
@@ -52,30 +52,8 @@ pub use self::diagnostics::DiagnosticMessageChain;
pub use self::diagnostics::Diagnostics;
pub use self::diagnostics::Position;
-pub static COMPILER_SNAPSHOT: Lazy<Box<[u8]>> = Lazy::new(
- #[cold]
- #[inline(never)]
- || {
- 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())
- as usize,
- )
- .unwrap()
- .into_boxed_slice()
- },
-);
+pub static COMPILER_SNAPSHOT: &[u8] =
+ include_bytes!(concat!(env!("OUT_DIR"), "/COMPILER_SNAPSHOT.bin"));
pub fn get_types_declaration_file_text(unstable: bool) -> String {
let mut assets = get_asset_texts_from_new_runtime()
@@ -137,7 +115,7 @@ fn get_asset_texts_from_new_runtime() -> Result<Vec<AssetText>, AnyError> {
}
pub fn compiler_snapshot() -> Snapshot {
- Snapshot::Static(&COMPILER_SNAPSHOT)
+ Snapshot::Static(COMPILER_SNAPSHOT)
}
macro_rules! inc {