Improve Bitmap cache #1018

merged 4 commits into from Sep 15, 2016


None yet

3 participants

Ghabry commented Aug 28, 2016

Instead of using weak_ptr is now shared_ptr and gives a 10 MB cache. Otherwise behaviour is the same as before. This prevents tons of cache misses (e.g. every frame during gauge battle) we usually get.

Cache clearing strategy:
When the cache limit is reached all entries not being accessed in the last 10 seconds are removed.

Debug output is enabled to better showcase that the cache works. will disable this before merging.

Ghabry commented Aug 29, 2016

That one here should be save to merge after testing (and removing that commit)

@fdelapena fdelapena added this to the 0.5.0 milestone Aug 29, 2016
Ghabry commented Aug 30, 2016

Here I observed OOM for TSTT on wii. So what you think? Reduce cache size? I can even set it to 0 and just use the timeout logic... actually maybe thats worth a try :D

@scurest scurest commented on an outdated diff Sep 1, 2016
@@ -34,23 +34,47 @@
namespace {
typedef std::pair<std::string,std::string> string_pair;
+ typedef std::pair<BitmapRef, uint32_t> bitmap_pair;
scurest Sep 1, 2016 Contributor

Wouldn't it be better to define a struct here? The .second.second stuff is kind of hard on the eyes.

Ghabry added some commits Aug 23, 2016
@Ghabry Ghabry Improve image cache. Stores bitmaps now until the cache size is excee…
…ded instead of when the last reference is lost which resulted in really bad cache hit rate.
@Ghabry Ghabry Prevent cache pollution by not creating invisible sprites for all bat…
…tlers in the party during battle start.
@Ghabry Ghabry Replace Cache pair with a struct for better readability
Ghabry commented Sep 10, 2016

PSA: This is done, struct is renamed, cache size is 0 (flush after 5 seconds of non-use)

@Ghabry Ghabry Regression fix from Tone change improvements: Also recreate the Plane…
… when the size changed.
@fdelapena fdelapena merged commit 1235fce into EasyRPG:master Sep 15, 2016

6 checks passed

Android (armeabi-v7a) Build finished.
GNU/Linux Build finished.
OSX Build finished.
Windows (x64) Build finished.
Windows (x86) Build finished.
web Build finished.
@Ghabry Ghabry deleted the Ghabry:cache_image branch Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment