[core] Implement Throttling Prioritized Package Loading (WIP - Open to Comment) #1168
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.
After a new wave of concerns over Pulsar's startup time it got me thinking back to dubious concerns about how well Atom's old performance hacks are still holding up.
The one closest to my heart being the way we load packages during startup.
The status quo now is essentially:
This PR aims to change this, if others are on board.
This PR would ditch the preload system entirely, with the amount of packages now bundled, I can't imagine this is really saving anyone time anymore. But more importantly, this PR would ditch loading all packages at once.
Instead using a throttled prioritization system. Where we assign a priority to all available packages, and load installed packages in waves, starting with the highest priority. The idea behind this hinges on the fact that not everyone uses Pulsar for the same tasks. Some users may never use
markdown-preview
just like some may never uselanguage-c
, so why do they both take up time during the startup when it wouldn't make any difference to the user if they started now or a few seconds later?While this is most certainly a very rough draft, and I haven't ironed out all the details of prioritization, here's the goals I'd like to achieve with prioritization:
tabs
,status-bar
,tree-view
, etcWhile this is very likely not totally inclusive, and in it's current state is far from that, my initial testing is rather promising:
Below I've launched an installed copy of Pulsar
v1.124.0
andv1.124.0-dev
on Windows 10. I launched each version 5 times and recorded thetime-cop
values for certain startup metrics.Before PR:
227ms, 243ms, 257ms, 261ms, 244ms
:: Average:246.4ms
1422ms, 1347ms, 1356ms, 1336ms, 1449ms
:: Average:1,382ms
81ms, 84ms, 79ms, 83ms, 90ms
:: Average:83.4ms
278ms, 276ms, 272ms, 271ms, 320ms
:: Average:283.4ms
After PR:
311ms, 270ms, 260ms, 258ms, 257ms
:: Average:271.2ms
814ms, 713ms, 701ms, 713ms, 708ms
:: Average:729.8ms
98ms, 85ms, 86ms, 82ms, 90ms
:: Average:88.2ms
53ms, 44ms, 42ms, 41ms, 41ms
:: Average:44.2ms
Results
246.4ms
:271.2ms
= On average a10%
ms increase after this PR1,382ms
:729.8ms
= On average a47%
ms decrease after this PR83.4ms
:88.2ms
= On average a5.7%
ms increase after this PR283.4ms
:44.2ms
= On average a84.4%
ms decrease after this PRSo while we can see these results do have some slight increases, if we in fact are removing on average
652.2ms
or47%
of our Window load time, and removing on average239.2ms
or84.4%
of our Workspace load time, this seemingly could make a pretty big difference to our subset of users who are concerned about startup time. All the while giving us and our users much finer control of their startup experience.Like I've mentioned several times, these ideas are very in progress, and are far from finalized. But after playing around with the code and seeing such a big difference, it seemed like a good idea to go ahead and post it, to get an idea of how we feel about a change as integral as this. So please feel free to share your ideas or thoughts, otherwise I'll continue trying to hone in on exact functionality here.