perf: prefer module.enableCompileCache over v8-compile-cache#574
Merged
aduh95 merged 2 commits intonodejs:mainfrom Nov 23, 2024
Merged
perf: prefer module.enableCompileCache over v8-compile-cache#574aduh95 merged 2 commits intonodejs:mainfrom
module.enableCompileCache over v8-compile-cache#574aduh95 merged 2 commits intonodejs:mainfrom
Conversation
aduh95
reviewed
Nov 17, 2024
Comment on lines
+403
to
+408
| // @ts-expect-error - Missing types | ||
| if (!Module.enableCompileCache) { | ||
| // Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache | ||
| // $ docker run -it node:20.3.0-slim corepack npm@9.7.1 --version | ||
| // [SIGSEGV] | ||
| if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) { |
Contributor
There was a problem hiding this comment.
nit: we can minimize the diff, to avoid cluttering git blame
Suggested change
| // @ts-expect-error - Missing types | |
| if (!Module.enableCompileCache) { | |
| // Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache | |
| // $ docker run -it node:20.3.0-slim corepack npm@9.7.1 --version | |
| // [SIGSEGV] | |
| if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) { | |
| // Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache | |
| // $ docker run -it node:20.3.0-slim corepack npm@9.7.1 --version | |
| // [SIGSEGV] | |
| if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) { | |
| // @ts-expect-error - Missing types | |
| if (!Module.enableCompileCache) { |
Member
Author
There was a problem hiding this comment.
I haven't benchmarked it but this would cause it to do work it doesn't have to.
Contributor
There was a problem hiding this comment.
Only for npm though, and if native support is disabled
Member
Author
There was a problem hiding this comment.
It would always affect npm as it has to check the version first.
Contributor
There was a problem hiding this comment.
Yeah that's what I'm saying, and if native support is indeed disabled – otherwise it would have to do the check anyway
aduh95
approved these changes
Nov 23, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Node.js has added a built-in compile cache so this PR changes the code to prefer that over
v8-compile-cache.https://nodejs.org/docs/v22.11.0/api/module.html#moduleenablecompilecachecachedir
Fixes #342
Closes #573 (supersedes it)
Results