Skip to content

Persist the V8 code cache before spawning a child process #54465

@merceyz

Description

@merceyz

What is the problem this feature will solve?

NODE_COMPILE_CACHE persists the V8 code cache when the process is terminating which means that if the script spawns itself then that child process wont benefit from the cache.

What is the feature you are proposing to solve the problem?

Persist the V8 code cache before spawning a child process so it can benefit from the cache.

import { execFileSync } from "child_process";

if (process.argv[2] === "foo") {
	console.log("foo");
} else {
	// Persist the V8 code cache
	console.log(execFileSync("node", ["test.mjs", "foo"]).toString());
}

What alternatives have you considered?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestIssues that request new features to be added to Node.js.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions