Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement: improve cli startup performance using v8 cache #6049

Merged
merged 2 commits into from
May 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions garden-sea/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,18 @@ where
#[cfg(all(target_os = "linux"))]
command.env("GARDEN_SEA_TARGET_ENV", TARGET_ENV);

// Experimental compile cache feature. Defaults to false for now, but we can enable it by default later if it works well.
// See also https://nodejs.org/api/cli.html#node_compile_cachedir
let enable_compile_cache = env::var("GARDEN_COMPILE_CACHE").unwrap_or("false".into());
if enable_compile_cache == "true" || enable_compile_cache == "1" {
let cache_dir = path.join("v8cache");
fs::create_dir_all(cache_dir.clone())?;
command.env(
"NODE_COMPILE_CACHE",
OsString::from(cache_dir),
);
}

// Allow users to override the heap size if needed.
let max_old_space_size = env::var("GARDEN_MAX_OLD_SPACE_SIZE").unwrap_or("4096".into());
let max_semi_space_size = env::var("GARDEN_MAX_SEMI_SPACE_SIZE").unwrap_or("64".into());
Expand Down