View Full Version : max_cache_size recommended value?
Selur
29th September 2024, 05:11
Using:
import vapoursynth as vs
core = vs.core
clip = core.std.BlankClip()
clip = core.text.Text(clip, str(core))
clip = core.std.Trim(clip=clip, first=0, last=1)
clip.set_output()
I see that 'Max Cache Size' is 4096.
max_cache_size
Set the upper framebuffer cache size after which memory is aggressively freed. The value is in megabytes.
source: http://vapoursynth.com/doc/pythonreference.html#Core.max_cache_size
Having 64GB RAM, I was wondering when it would make sense to increasing/decreasing this value.
Is there a recommended value for max_cache_size?
Has anyone done some testing whether/when increasing/decreasing makes sense?
Cu Selur
Myrsloik
29th September 2024, 11:34
If you process very high resolution things it can make sense. Note that if the cache ever becomes full you'll get a warning.
Unlike avisynth that always caches up to the max limit vapoursynth will shrink/grow caches based on what's optimal for the current request pattern. That means you can check the ram usage in task manager or similar and see if increasing would do anything at all.
4GB is enough for just about all fullhd script and probably a significant number of 4k ones.
Selur
29th September 2024, 11:58
Thanks for clearing that up, since I never saw a warning about cache, I should be fine. :)
Cu Selur
Selur
19th July 2025, 09:28
Using vs_temporalfix with 4k and the default max_cache_size is 50% slower than using it with max_cache_size=16384. Increasing max_cache_size (i.e. 32768) doesn't really boost the speed and less (i.e.8196) doesn't fair better than the default, but worse than 16384.
When using for example using max_cache_size=32768 and running a script, can one somehow see what cache is actually used? (can this maybe even be monitored per filter?)
I'm thinking about:
a. setting max_cache_size to some max current free memory
b. running a script for a portion and getting the used max_cache_size
c. setting max_cache_size to roughly (a bit more) the detected used max_cache_size
to optimize max_cache_size. :)
Cu Selur
Myrsloik
19th July 2025, 09:44
You get a warning if it's definitely too low. Double if that's the case.
The problem is that looking at the max used cache is quite misleading as well since it usually shrinks quite a bit once the request patterns have been figured out.
I'd recommend simply setting it to something like 3/4 of your ram. Caches will shrink themselves, this isn't avisynth where they stay huge.
Selur
19th July 2025, 10:35
Okay, thanks.
Selur
20th July 2025, 04:41
Small follow-up question for better understanding this :)
Assuming I got 64GB RAM, and a script that uses 45GB RAM with the default max_cache_size = 0 <> 4096.
Will I run into problems when I set max_cache_size to 3/4 or my systems ram (core.max_cache_size = 48473), or will I just potentially get 'warnings' when the specified max_cache_size can't be used?
Cu Selur
Myrsloik
20th July 2025, 12:25
Small follow-up question for better understanding this :)
Assuming I got 64GB RAM, and a script that uses 45GB RAM with the default max_cache_size = 0 <> 4096.
Will I run into problems when I set max_cache_size to 3/4 or my systems ram (core.max_cache_size = 48473), or will I just potentially get 'warnings' when the specified max_cache_size can't be used?
Cu Selur
You never get "problems", what you get is either slowdown due to the cache being too small (and maybe a warning) or slowdown due to the cache using too much ram and things start paging.
You obviously don't get warnings if less memory than max_cache_size is required.
Selur
20th July 2025, 14:33
Okay, thanks for the info.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.