Skip to content
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

Optimize memory with DBBitArray #390

Merged
merged 4 commits into from Sep 4, 2020
Merged

Optimize memory with DBBitArray #390

merged 4 commits into from Sep 4, 2020

Conversation

fmatthew5876
Copy link
Contributor

@fmatthew5876 fmatthew5876 commented Aug 28, 2020

Depends on #379

I've added support for DBBitArray as a replacement for vector<bool>. This data structure again uses the same memory allocation strategy as DBString and DBArray.

Game Ldb Size #379 This PR
HH3 16MB 68.7 MB 68.5MB
Heroes Realm 27MB 143.3 MB 143.3MB
Violated Heroine 11MB 41.4 MB 40.6MB
Yume 2kki 1.4MB 4.9 MB 4.8MB

The overall savings here are pretty modest Lets look more closely at hh3's database with certain structs compiled out. This game has 850 skills and 2280 items.

Memory usage:

All except troops & common events Only Items Only Skills
#379 3.2MB 936.5KB 354.3KB
This PR 2.9MB 651.8KB 302.0KB

So overall, we see a good % reduction in the size of items and skills. Unfortunately these don't make up a huge portion of the database, so the total win is pretty small.

Still overall, it's a net gain and could help a bit on memory constrained systems.

@Ghabry
Copy link
Member

Ghabry commented Aug 28, 2020

Nice. Any memory saving >300 KB is worth it. That's the size of one 320x240 picture. So it decreases the chance for a oom condition slightly 👍.

@fdelapena fdelapena added this to the 0.6.3 milestone Sep 2, 2020
@Ghabry Ghabry merged commit a944fd6 into EasyRPG:master Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

3 participants