KSPModdingLibs / KSPCommunityFixes

Community patches for bugs in the KSP codebase
49 stars 17 forks source link

Loading and general core infrastructure micro-optimization #228

Open gotmachine opened 3 months ago

gotmachine commented 3 months ago

This is intended to be a meta-issue tracking possible performance improvements by micro-optimizing stock methods. The focus is mainly to try get ride of some overhead during part compilation and scene switches.

Note that frame time or performance numbers are obtained from deep profiling sessions, so the figures will be heavily skewed for methods having a deep call stack, and more representative for methods at the bottom of call stacks. For reference, here is the unity profiler (2019.4) deep profile dump I used, this only span over part compilation, and is in a more or less stock install (no KSPCF) : https://drive.google.com/file/d/1MI_D634zUTt16F8VVJnFZ7maM5vgCxZN/view?usp=sharing

On a side note, the fact that the vast majority of the part compilation time is spent in the various components Awake() methods mean that the whole idea (that I was very skeptical with) of trying to "compile" assetbundles out of the prefabs for future loadings just wouldn't improve anything.