Snayff / nqp2

An exploration of a fantasy world, to autobattle your way to ruling the demesne.
https://snayff.github.io/nqp2/
Other
12 stars 5 forks source link

Lazy loading images #318

Closed douglascdev closed 2 years ago

douglascdev commented 2 years ago

Suggested Feature

Currently, the game takes 9.24 seconds to open for me on an HD. The performance benchmarking log suggests that the main reason is the "Visual" module taking 7.62 seconds to load, mostly because of the images in the event_images folder.

After a crude implementation of lazy image loading the startup took 2.02 seconds, with Visual taking 0.45 seconds, less than 6% of the time.

The obvious drawback is that since the loading times are split between the places they are first referred to in the code, some players could experience a hiccup in FPS when loading some images for the first time. I think the tradeoff is worth it, especially as most images would seemingly load when transitioning from one scene to another, and most images are very small anyway.

Requirements

Snayff commented 2 years ago

Love it, yes please!