summaryrefslogtreecommitdiff
path: root/src/snapshot.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2019-01-29 11:41:28 +1000
committerRyan Dahl <ry@tinyclouds.org>2019-01-28 20:41:28 -0500
commitee9c627cc5f92898d104e9359059b57354c9f83c (patch)
tree397428aa26133100e78565755a8b8db169c12131 /src/snapshot.rs
parentf7c0f4944352f5bd2bb04d6c64e6259357d3827a (diff)
Split out compiler snapshot (#1566)
Speeds up startup time, reduces runtime heap size.
Diffstat (limited to 'src/snapshot.rs')
-rw-r--r--src/snapshot.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/snapshot.rs b/src/snapshot.rs
index 16a186c29..ac1648e0c 100644
--- a/src/snapshot.rs
+++ b/src/snapshot.rs
@@ -12,3 +12,15 @@ pub fn deno_snapshot() -> deno_buf {
unsafe { deno_buf::from_raw_parts(data.as_ptr(), data.len()) }
}
+
+pub fn compiler_snapshot() -> deno_buf {
+ #[cfg(not(feature = "check-only"))]
+ let data =
+ include_bytes!(concat!(env!("GN_OUT_DIR"), "/gen/snapshot_compiler.bin"));
+ // The snapshot blob is not available when the Rust Language Server runs
+ // 'cargo check'.
+ #[cfg(feature = "check-only")]
+ let data = vec![];
+
+ unsafe { deno_buf::from_raw_parts(data.as_ptr(), data.len()) }
+}