4 ms·
> CoroBase is a research database engine that models transactions as C++20 stackless coroutine to hide CPU cache misses. Can someone please explain that this m
by riyadparvez 6y ago
> CoroBase is a research database engine that models transactions as C++20 stackless coroutine to hide CPU cache misses.
Can someone please explain that this means? I am really curious to know.
- scott_s 6y agoTheir research paper explains the work: https://arxiv.org/pdf/2010.15981.pdf https://arxiv.org/pdf/2010.15981.pdf
- deleted 6y ago[deleted]
- stingraycharles 6y agoThe gist is that C++ coroutines’ context switches are cheaper than cache misses. Hence, if you can write coroutines that fill the caches more intelligently than that the hardware prefetcher can do (because you know more about what your application is trying to achieve), you can outperform the hardware prefetcher. You write a whole lot of coroutines that fill caches, suspend them while they do it, and once they are resumed, you can assume that the caches are now filled with your data and have just achieved better efficiency. Hope this was a clear enough explanation, and someone correct me if I’m wrong.
- qppo 6y agoNot an expert here but I think there's a non trivial detail to your gist, which is that (user space) context switches can be faster than cache misses, and you can design a scheduler that knows enough about its coroutines to switch to a new context with a low probability of a cache miss.