New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Bitmap cache #1018

Merged
merged 4 commits into from Sep 15, 2016

Conversation

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

This comment has been minimized.

Show comment
Hide comment
@Ghabry

Ghabry Aug 29, 2016

Member

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

Member

Ghabry commented Aug 29, 2016

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

@Ghabry

This comment has been minimized.

Show comment
Hide comment
@Ghabry

Ghabry Aug 30, 2016

Member

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

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

Show outdated Hide outdated 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;

This comment has been minimized.

@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.

@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

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

This comment has been minimized.

Show comment
Hide comment
@Ghabry

Ghabry Sep 10, 2016

Member

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

Member

Ghabry commented Sep 10, 2016

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

@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