Repository navigation
Various optimizations and some cleanup - #38
Merged
Merged
Conversation
This was a short-lived test bed for the platform part of HTTP support, now made redundant by `fetch` and `FetchEvent` support.
And remove some that aren't in use anymore.
Iterating a `Headers` object ran `sort and combine` over the whole list on every step. `CachedHeaderList` wraps the list and computes that form once, on first use, and every mutable access to the list drops it again.
The GC schedules collections from the bytes reported to it, and a body's byte source lives in Rust memory outside the GC heap. Objects holding large bodies were invisible to the heap-growth heuristics, so building many of them grew memory until the process ran out. `js::gc::AssociatedMemory` wraps `JS::AddAssociatedMemory`. That accounting is keyed by the object's address and a compacting GC relocates tenured objects, so every call takes the object's current address: a rooted handle while the object is alive, and the finalizer's argument once it is being finalized. `#[destructor]` therefore takes an optional second parameter holding the object being finalized, and a class declared with `extends` runs its parent's destructor after its own. `Request` and `Response` hold an `AssociatedMemory`, re-sync it wherever the byte source is set, taken, cloned or dropped, and release it from their destructors. One test builds bodies in a loop and checks that collections happen. Another relocates accounted objects with a compacting GC and checks that both the update and the release go through the new address.
The global resolves standard classes lazily, on first use. An instance restored from a snapshot paid for each one in the first request that touched it. `pre_initialize` now defines them all before the snapshot.
tschneidereit
force-pushed
the
optimizations
branch
from
September 24, 2026 08:01
5591a56 to
1e13625
Compare
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.
This is a bit of an assortment of changes that don't fit a clear pattern, but are individually too small to PR. I'll land them as separate commits, so they don't get bundled up into an incoherent mess.