Optimize SpiderMonkey fetch dispatch#8
Open
Copilot wants to merge 8 commits into
Open
Conversation
Copilot created this pull request from a session on behalf of
VrilLabs
May 30, 2026 05:33
View session
Contributor
Summary:Optimized SpiderMonkey fetch dispatch by avoiding per-request evaluate_script.
Validated: cargo build
cargo test -p helios
cargo check -p helios --features spidermonkey
cargo fmt --checkparallel_validation: code review completed; CodeQL timed out per tool limit. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR wires an optional native SpiderMonkey backend into HELIOS and changes the SpiderMonkey fetch path to call the registered dispatcher directly rather than re-evaluating generated JavaScript per request.
Changes:
- Adds
mozjsas the optional dependency behind thespidermonkeyfeature. - Implements a SpiderMonkey-backed engine path in
xdr.rs, including directJS_CallFunctionNamedispatch and warmup. - Switches the CLI to select SpiderMonkey when the feature is enabled; several other files are formatting-only changes.
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
rs/helios/src/xdr.rs |
Adds the SpiderMonkey backend implementation and tests. |
rs/helios/src/main.rs |
Selects Boa or SpiderMonkey as the active CLI engine based on feature flags. |
rs/helios/Cargo.toml |
Adds optional mozjs dependency to the spidermonkey feature. |
rs/Cargo.lock |
Records the new SpiderMonkey dependency graph. |
rs/helios/src/boa_backend.rs |
Formatting-only changes. |
rs/helios/src/wizer_build.rs |
Formatting-only changes. |
rs/helios/src/wit_host.rs |
Formatting-only changes. |
rs/helios/src/webtransport.rs |
Formatting-only changes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+842
to
+843
| headers: req.headers || [], | ||
| body: req.body || [] |
Comment on lines
+558
to
+562
| pub(super) unsafe fn shutdown_engine_for_tests() { | ||
| if let Some(ptr) = ENGINE.get().copied().filter(|ptr| *ptr != 0) { | ||
| drop(unsafe { Box::from_raw(ptr as *mut JSEngine) }); | ||
| } | ||
| } |
Comment on lines
+853
to
+855
| if (!captured) { | ||
| throw new Error('fetch handler did not call event.respondWith()'); | ||
| } |
…afety, add respondWith validation
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.
SpiderMonkey benchmarks were near parity with Boa because each request re-entered JavaScript through generated script evaluation. This changes the hot path to invoke the registered fetch dispatcher directly.
SpiderMonkey dispatch
evaluate_script("__helios_call_fetch(...)")withJS_CallFunctionName.Warmup path