Commit 1e8d4aa
perf: Load asset bundles asynchronously during texture load (#344)
* perf: Load asset bundles async during texture load
On my dev install KSP spends 4.5s on the initial asset bundle load step.
It is possible to load these asynchronously while we are doing other
work.
This commit:
- Starts the async bundle loads before FastLoader loads audio resources,
models, or textures.
- Replaces AssetLoader.LoadAssetDefinitions with a version that uses the
preloaded asset bundle requests, if available.
- Optimizes the directory walk in (now) PreloadAssetDefinitions to use
plinq, and removes some unnecessary work.
- Does a few extra tweaks to attempt to asynchronously load asset
bundles even if they have the same name as an existing bundle.
After this change the final time spent on loading asset bundles is
~0.4s.
I have attempted to match the previous behaviour as closely as possible.
There is a bug in the KSP version of this code where it tries to put
asset bundles in the `SquadExpansions` folder at the start of the list,
but due to what looks like a typo it just walks the `Squad` folder
again. This hasn't seemed to cause a problem since it was addeed, so I
have just left it in.
There is one behaviour change, though, new bundle dependencies are now
added to the end of the list instead of the next position in the list,
this gives them more time to load in the background.
* Update CHANGELOG
---------
Co-authored-by: JonnyOThan <jonnyothan@gmail.com>1 parent f225ae7 commit 1e8d4aa
3 files changed
Lines changed: 287 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
83 | 87 | | |
84 | 88 | | |
85 | 89 | | |
| |||
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
| 100 | + | |
96 | 101 | | |
97 | 102 | | |
98 | 103 | | |
| |||
0 commit comments