Daily Shaarli
July 15, 2024
Given a linked list which happens to sit on consecutive memory, traversing it can take advantage of L1 cache. However it's possible to squeeze more performance by hinting the branch predictor to allow speculative execution, resulting in better parallelism with cpu pipelining. This is a simple and interesting trick although I can't think of much practical uses except for specific scenarios.