diff options
author | MahouShoujoMivutilde <14999778+MahouShoujoMivutilde@users.noreply.github.com> | 2022-01-01 11:55:59 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-01 14:55:59 +0600 |
commit | e777adf98534394ca005a1ca541696b06c791aa6 (patch) | |
tree | ca62045ac14db93ff173c2b31a47edc34cba568d /nsxiv.h | |
parent | 1a691d42f6893e7bd6d18d541a9a46d87223c9cc (diff) |
Allow setting cache size based on memory percentage (#184)
The problem:
1. For the most people imlib2's default 4MiB is unreasonably low;
2. Hardcoding cache size to ~256MiB has performance benefits and doesn't
increase RAM usage too much on relatively modern systems;
3. But we can't do that, because that would be detrimental to low spec systems
that (apparently) not (?) building nsxiv from source, as been discussed
#171
Solution:
Calculate cache size based on total memory.
Default is set as 3%, which means:
* ~245MiB for 8GiB
* ~30MiB for 1GiB
* and so on
CACHE_SIZE_LIMIT (256MiB by default) sets the highest possible value. And in
case we cannot determine the total memory (e.g since _SC_PHYS_PAGES isn't
POSIX) use CACHE_SIZE_FALLBACK (32MiB by default) instead.
Co-authored-by: NRK <nrk@disroot.org>
Diffstat (limited to 'nsxiv.h')
0 files changed, 0 insertions, 0 deletions