4 ms·
How hard is it to empirically detect cache size at startup and tune the algorithms based on that? I guess you'd miss out on inlining / constant folding opportu
by ReactiveJelly 6y ago
How hard is it to empirically detect cache size at startup and tune the algorithms based on that?
I guess you'd miss out on inlining / constant folding opportunities. If you didn't have a JIT.
- jazzkingrt 6y agoCertainly possible. Glibc has the sysconf function which can provide the cache sizes at runtime. https://www.gnu.org/software/libc/manual/html_node/Constants-for-Sysconf.html https://www.gnu.org/software/libc/manual/html_node/Constants... However, consider a scenario like a database where you might store on disk once and don't get cheap opportunities to reorganize data when the memory or processor hardware is switched out. Or when your data is sent over the network for processing by some arbitrary client hardware.