Improve Bitmap cache #1018

Merged
merged 4 commits into from Sep 15, 2016

Projects

None yet

3 participants

@Ghabry
Member
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
Member
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
Member
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
src/cache.cpp
@@ -34,23 +34,47 @@
namespace {
typedef std::pair<std::string,std::string> string_pair;
+ typedef std::pair<BitmapRef, uint32_t> bitmap_pair;
@scurest
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.
ee0afd3
@Ghabry Ghabry Prevent cache pollution by not creating invisible sprites for all bat…
…tlers in the party during battle start.
f0084c7
@Ghabry Ghabry Replace Cache pair with a struct for better readability
4fa1dd4
@Ghabry
Member
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.
47a26d4
@fdelapena fdelapena merged commit 1235fce into EasyRPG:master Sep 15, 2016

6 checks passed

Android (armeabi-v7a) Build finished.
Details
GNU/Linux Build finished.
Details
OSX Build finished.
Details
Windows (x64) Build finished.
Details
Windows (x86) Build finished.
Details
web Build finished.
Details
@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