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

Ignore less cached data when more is available #101778

Merged
merged 1 commit into from Jul 6, 2020
Merged

Conversation

jrieken
Copy link
Member

@jrieken jrieken commented Jul 6, 2020

This PR helps with #101685. While drilling into a potential startup regression I have realised that calling createCachedData can yield less data than returned in previous rounds. It's not entirely clear to me why but having less cached data will negatively impact startup performance.

@jrieken jrieken self-assigned this Jul 6, 2020
@jrieken jrieken requested a review from alexdima July 6, 2020 06:25
@jrieken
Copy link
Member Author

jrieken commented Jul 6, 2020

@hashseed can you help me understand how this goes? For VS Code we use NodeJS's createCachedData-API (Node.js: 12.8.1, V8: 7.8.279.23-electron.0). We call createCachedData repeatedly with the idea that as more code is being parsed more cached data is created. However, it seems that it gets less and less, e.g for VS Code's main bundle we have the following cached data sizes: 9.4MB, 5MB, 3MB (3 calls, immediate after startup, after ~30sec, after ~3min).

@hashseed
Copy link

hashseed commented Jul 6, 2020

Maybe code got garbage-collected?

@jrieken
Copy link
Member Author

jrieken commented Jul 6, 2020

Ah, that would explain it. So, at startup all the code is parsed (to some level of depth) and then GC'ed when unused. That makes sense to me. We should take this has a hint that our main bundle is too large... Thanks

@hashseed
Copy link

hashseed commented Jul 6, 2020

Not quite. V8 usually does not compile functions before it's executed for the first time. So this indicates to me that some code was used at startup, but is no longer used afterwards. V8 also has a code aging mechanism to get rid of stale code that has not executed for a longer time period.

@jrieken
Copy link
Member Author

jrieken commented Jul 6, 2020

hm... any flags that I can set to trace this?

Copy link
Member

@alexdima alexdima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jrieken jrieken merged commit 79904b3 into release/1.47 Jul 6, 2020
@jrieken jrieken deleted the joh/fix/101685 branch July 6, 2020 10:24
@github-actions github-actions bot locked and limited conversation to collaborators Aug 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants