-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix(node): seperate worker module cache #23634
Changes from 2 commits
a365598
b1b35bd
2dfeacf
bea3f52
99f4ad5
c577004
85d311e
a425210
031e841
02950d7
5766b6b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: it would be nice to convert this test into a step under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm. I thought it would be clean to convert several tests of a module into steps but it will break reporting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After #23667, you can now declare serveral tests in |
||
"args": "run -A main.ts", | ||
"out": "main.out" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Module: null prototype] { default: true } | ||
[Module: null prototype] { default: false } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import fs from "node:fs/promises"; | ||
import { isMainThread, Worker } from "node:worker_threads"; | ||
|
||
await fs.writeFile("mod.mjs", "export default " + isMainThread); | ||
|
||
const path = new URL("mod.mjs", import.meta.url); | ||
const i = await import(path.href); | ||
console.log(i); | ||
|
||
if (isMainThread) { | ||
const worker = new Worker(new URL("test.mjs", import.meta.url)); | ||
worker.on("message", (msg) => console.log(msg)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How's the memory usage? Does it reuse the
Arc<str>
when it can? (ex. for remote modules)Also, what happens with
--reload
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@littledivy do you think we could reduce memory usage by sharing the strings in memory when they're the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, maybe we could store specifier -> hash mapping in a shared container and compare that in the file fetcher. Doing this check without comparing specifiers first may be expensive but more effective in some cases.