I feel like I could learn a lot just studying this ; just a curiosity ; how do you know if stuff is within L1 cache or not ? Are there kernel fn for that ? or just trough benching ?
If you loop through an array once, and then iterate through it again you can figure out where it will be cached based on the array size.