Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Cache improvements and effect caching #1760
not ready yet, have strange flickering.
Improved the caching strategy, before our Cache was unlimited and never cleared any recently (<5s) used assets. Now the clear is forced when the memory usage is 10 MB (+3 MB SE).
Which means the memory foodprint is in simple games (havn't used the MSVC memory profiler yet) ~20 MB plus Database.
Besides reduced memory usage the effect cache should also help in some situations to make the effect faster because tone & flash are only calculated once now per same charset.
Comparison images: (already making them now, as the "flicker fix" won't increase the memory usage)
Note: These are manual recordings, so the time axis won't match, look at the memory usage.
Obviously highly suggestive because I picked the most crazy examples. In IB e.g. the change is around 0, stays at ~22 MB the whole time.
The Looking Glass:
RPG_RT: 21 MB but they have two advantages: They use 16bit and for Tone effect they modify the palette instead of copying.
This branch up to "Fix out of bounds":
RPG_RT: 37 MB
The flicker fix also will contain yet another minor improvement: It saves 258 KB per CharSet that is affected by a screen effect. Saves a non measurable amount for "The Looking Glass" and 2 MB in Yume2kki.
The "Operator <" is required for keys in std::map.
I can make it non-const.
Unless it's going to be exposed as a runtime config parameter I would leave it constexpr, at least then you can maybe eke out some additional compile time optimizations.