D2 log 048 – Load time improvements, pt.2

I did some more loading optimizations.

Last time I managed to make nice improvements by using multiple threads. As I’ve been adding more and more assets, the load time has crept up again since then. 

This time I did two things.

Instead of decoding all PNGs and cropping them on each start, I do it once and write the result to disk as cache. Next time I just compare timestamps and load the processed image directly. This is much, much faster. The final release will have only the processed images in a PAK file.

Second, I profiled the startup sequence and found that a lot of time was spent building fonts. In particular, it was the Material Icons font, which isn’t even used when the game is run normally – it’s only for editor icons! I wanted to keep dynamic loading for the other fonts so I just replaced the few icons I actually needed with prerendered bitmaps and got rid of the icon font.

Loading times are really quick again which makes iteration much more pleasant.