desc cache - optimize or remove?
adcxyz opened this issue · 3 comments
Hi,
I am wondering what to do about the MKtlDesc writeCache/loadCache concept.
The tradeoffs are these:
When desc files stay the same, cache allows not loading all descs to find the one you are looking for, saving CPU time and memory space, at the expense of staticness: When new descs are added, it takes several rounds involving writeCaching before they are auto-found reliably.
So the options are
- keep caching and improve its lookup logic to be faster
- ditch caching to make it fully dynamic, at the price of slower MKtl startup and device desc lookup.
Opinions?
best a
how much slower would be (2.)? Can we test?
@LFSaw thanks for asking for tests, that does answer it:
// On Macbook Pro 2015, 2.9GHz, OS 10.11.6:
// find single desc by partial file name
bench { MKtlDesc("*trol2"); }; // 0.003
bench { MKtl(\x, "*trol2"); }; // 0.007
bench { MKtl(\y, "*trol2"); }; // 0.007
// load
bench { MKtlDesc.loadDescs }; // 0.76 sec
bench { MKtlDesc.loadCache }; // 0.0015
bench { MKtlDesc.writeCache }; // 0.8, does full loadDescs first
-> loading all descs will be annoyingly slow on little systems (raspi or bela),
so it is worth keeping the cache.
actually one can simply compare mtime of newest desc file with cache,
and update cache only when descs are newer.