Skip to content
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

Boa's start-up time getting hit with GC Allocation #3896

Open
jasonwilliams opened this issue Jul 7, 2024 · 4 comments
Open

Boa's start-up time getting hit with GC Allocation #3896

jasonwilliams opened this issue Jul 7, 2024 · 4 comments
Labels
bug Something isn't working performance Performance related changes and issues

Comments

@jasonwilliams
Copy link
Member

Boa spends a large proportion of time in realm creation comparitive to actually running the code.
It seems a lot of this is due to building out the global objects on the heap and storing them causing the GC to do multiple collections before the program has even started.

We may wish to look at some sort of snapshot for built-ins or staticlly storing them somewhere (switch of GC for built-ins)

You can load the below profiler into ui.perfetto.dev or chrome developer tools and take a look.
image

chrome_profiler.json

@jasonwilliams jasonwilliams added bug Something isn't working performance Performance related changes and issues labels Jul 7, 2024
@nekevss
Copy link
Member

nekevss commented Jul 7, 2024

Raising the threshold at the below might help.

threshold: 1024,

@raskad
Copy link
Member

raskad commented Jul 7, 2024

Raising the threshold at the below might help.

threshold: 1024,

Yeah I also think we should raise the default threshold and make it configurable from outside of boa_gc.

@jasonwilliams
Copy link
Member Author

jasonwilliams commented Jul 9, 2024

I ran cargo run --profile=release-dbg --bin boa --features=dhat debug/script.js

Hello world!
undefined
dhat: Total:     611,648 bytes in 3,019 blocks
dhat: At t-gmax: 382,386 bytes in 2,283 blocks
dhat: At t-end:  354,488 bytes in 2,258 blocks

Also I've noticed that in DHAT we spend a lot of time growing the vector for property_table.
image

If we know ahead of time how many static methods are on a builtin, we should be passing this number through so it can create the vec::with_capacity(n)

@jasonwilliams
Copy link
Member Author

We’re not able to set each property_table with a capacity right now due to the fact that for each template the inner shape is cloned from the first shape.

We may need to set new root shapes here, each one having its own set of prototype storage capacity and property capacity.

@HalidOdat thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working performance Performance related changes and issues
Projects
None yet
Development

No branches or pull requests

3 participants