snorrwe
snorrwe.bsky.social
snorrwe
@snorrwe.bsky.social
I like to write software.

Blog: https://snorrwe.org/
Oh definitely, the array is also a monotonically increasing array of numbers. But I often find that when your data are in L1 cache, linear scan is pretty fast.
January 26, 2026 at 7:18 AM
Then you can store 102/4=25 floats in these cache-lines. So you could cut the search space in 26 with very little - to no overhead.
I've only implemented this in C++ and Rust, I don't know how to do this in C# 😕
January 20, 2026 at 11:12 AM
You can stick a fixed sized array of size N in the rest of the space, split the original array into N+1 chunks, and you can use a linear scan to find which chunk you need to search.
So if you assume you have 128 bytes to play with, 24 needed for the array, and you're using 32 bit floats
January 20, 2026 at 11:12 AM
So, it's still O(n), but what I did in the past for the same problem is build a skiplist inside the data structure's cache-line, the CPU prefetcher *usually* also gets the next line for you, so you have 128 bytes you can query for effectively free, while the array only really needs 16 or 24 bytes.
January 20, 2026 at 11:12 AM
Me literally every day:
docker-compose up
Shit
docker compose up
May 23, 2025 at 9:53 AM