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
Startup snapshots #1372
Comments
Starlight implements them almost like in V8 and Boa for sure will need custom GC for this plus a lot of unsafe code. Custom GC is required because for serialization and deserialization how objects are allocated does matter plus all the GC objects need to implement some trait for deser/ser, in Starlight there is a base trait for all GCed objects: Serialization and deserialization impl is there: |
Yeah we need a new GC, |
For me main problem with all the GC crates in Rust is not only the control but how slow and memory inefficient they are. rust-gc if I understand correctly uses reference counting to handle root references which is very slow while other JS engines: V8,JSC and now Starlight just use conservative stack scanning to find roots. There's also alternative like in SpiderMonkey to use shadow stack and Starlight also implements it but its impl is very unsafe and I am not sure if it is possible to implement in safe rust... |
Does V8 use conservative stack scanning? I thought it managed roots through scopes ( Matching this in rust would allow us to use lifetimes with scopes and handles, so we could make them more safe. |
They did use handles and scopes but now these are just no-op IIRC. They now use the same GC as Blink does: Oilpan GC. It is mostly precise. |
Because JavaScript describes so many objects creating them on every
Context
creation takes some time. But with snapshots we only do it once then we serialize them into a snapshot binary file and all other Context creation just deserializes this binary snapshot file.V8 uses snapshots to speed up context creation
This will probably require a lot of changes maybe we will need to write our own garbage collector for easier serialization and deserialization.
The text was updated successfully, but these errors were encountered: