Commit f225ae7
perf: Load expansion bundles asynchronously in the background (#345)
* perf: Load expansion bundles asynchronously in the background
This commit completely overrides ExpansionLoader so that asset bundles
are loaded in async and in parallel while part compilation is being
done. These take a _really_ long time to decompress so it isn't able to
completely hide the latency but it seems to improve overall loading time
by ~10s on a stock + KSPCF install. As the time taken in part
compilation increases the time saved should continue to improve until
part compilation takes longer than about 13s, which is how long it takes
to unload the `serenity_assets` asset bundle.
The implementation details are:
- we now start our own LoadExpansionsV2 coroutine immediately after
patching which waits one frame then starts async background loads
of all the asset bundles
- once the bundles are loaded the coroutine waits until StartLoad is
called and then goes and does the normal load for each of the
expansion bundles in the usual order.
- I have also moved checksum calculations off to a background thread,
though I doubt this makes much of a difference.
I haven't tried to optimize anything else other than moving the asset
bundle load off the main thread because I don't think there's much worth
optimizing there.
Other compatibility notes:
- this patch disables itself if the OptionalMakingHistoryDLCFeatures
patch is enabled and configured to skip loading of the expansions.
* Update CHANGELOG with new performance patch
---------
Co-authored-by: JonnyOThan <jonnyothan@gmail.com>1 parent ce92223 commit f225ae7
4 files changed
Lines changed: 390 additions & 0 deletions
File tree
- GameData/KSPCommunityFixes
- KSPCommunityFixes
- Performance
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
492 | 492 | | |
493 | 493 | | |
494 | 494 | | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
495 | 498 | | |
496 | 499 | | |
497 | 500 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
| |||
0 commit comments