test-tlb
Stupid memory latency and TLB tester
This is a tool that measures how fast your computer's memory system really is. Instead of relying on manufacturer specs, it actually runs tests on your machine to show you real-world memory access speeds and how efficiently your CPU's memory caches are working.
When you run the program, it creates patterns of memory access—sometimes reading data in a predictable stride (like every 64 bytes), and sometimes jumping around randomly—and times how long those operations take. It does this across different memory sizes, starting tiny (4 kilobytes) and growing all the way to 256 megabytes. The goal is to see where your latency changes as you move beyond your CPU's fast caches into slower main memory, and to reveal quirks in how your specific hardware behaves. It can also test using larger "hugepages" if your system supports them, which helps isolate the effect of Translation Lookaside Buffer (TLB) misses—a performance problem that happens when the CPU's address-translation hardware gets overwhelmed.
Computer engineers, system administrators, and hardware enthusiasts use this to understand their machine's true memory performance. If you're curious why a particular server feels slow, or you're designing code that needs to be memory-efficient, this tool shows you the actual numbers instead of guesses. It's especially useful for spotting unexpected bottlenecks: for instance, you might discover that your CPU cache works great up to a point, then hits a wall far sooner than you'd expect, or that using huge pages dramatically improves performance in ways standard benchmarks don't reveal.
The README is candid about what this tool is: a quick hack with hardcoded values you'll likely need to tweak for your specific machine (CPU frequency, page size, cache line size, and memory size). Results can vary significantly depending on how your operating system maps virtual memory to physical RAM, so for real insights you should run it multiple times. It's not meant to give ultra-precise numbers, but rather to show you patterns and relative differences that tell a true story about your hardware's behavior.