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
perf: warm expensive init code at snapshot time #22714
Conversation
b244f4d
to
0c0b22d
Compare
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.
I like this approach more. bootstrap code ∝ startup time
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.
Everything looks okay to me, but this completely breaks cargo build --features __runtime_js_sources
.
When I try to run a file:
console.log(Deno);
I get this:
$ cargo build --features __runtime_js_sources
$ ./target/debug/deno run foo.js
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.
Platform: macos aarch64
Version: 1.41.2
Args: ["./target/debug/deno", "run", "foo.js"]
thread 'main' panicked at /Users/ib/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.269.0/runtime/jsruntime.rs:603:9:
Failed to initialize a JsRuntime: TypeError: Cannot read properties of undefined (reading 'length')
at Object.internals.__bootstrapNodeProcess (node:process:888:30)
at initialize (ext:deno_node/02_init.js:30:15)
at ext:runtime_main/js/99_main.js:917:1
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Since we're working on a lot of Node compat APIs at the moment, we should preserve __runtime_js_sources
working.
@bartlomieju Confirmed that |
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.
Awesome! Excited to see its impact
WIP -- slightly different approach to similar changes in #22386
Note that this doesn't use a warmup script -- we are actually just doing more work at snapshot time.