Posted in

How does the Whetstone benchmark test integer operations?

If you’ve ever worked with embedded systems, compilers, or hardware performance testing, chances are you’ve run into Whetstone. I’ve been supplying Whetstone test suites and related tools for over a decade, and one of the questions I get asked most often is, “How the hell does this benchmark even test integer operations? It’s famous for floating-point, right?” Fair call—most folks associate Whetstone with crunching decimals for CPU benchmarking, but it does a whole lot more for integer work than most casual users realize. Let me break this down like I would to a new client stopping by my workshop, no stuffy whitepaper jargon. Whetstone

First, let’s ground this: Whetstone isn’t a single line of code. It’s a curated suite of small, targeted routines, originally written in Algol 60 back in the 70s by a group at the National Physical Laboratory in the UK. Over the years it’s been ported to every language under the sun—C, Python, Rust, even embedded assembly, which is what I deal with most for my clients. The original test was built to mimic the kind of operations real-world software actually runs: not just random math problems, but the stuff compilers churn out, the loops that run in operating systems, and the integer logic that makes embedded devices (like the ones my customers build medical sensors, smart thermostats, or industrial controllers on) tick.

Now, integer operations specifically—this is where I’ve seen a lot of people get tripped up. They expect a benchmark to do something like “add two numbers 10 million times” and call it a day, but that’s not useful. That’s not what real software does. Real code mixes integer math with control flow, memory access, and conditional logic, all of which play just as big a role in integer performance as the actual add/subtract operations. Whetstone gets this, which is why its integer tests are woven into every single part of the suite, not tucked away in a corner.

Let’s start with the core integer building blocks. Whetstone hits all the standard stuff, but in realistic contexts. For example, take the array index operations. A huge portion of integer work in loops is figuring out where to place data in memory, right? Like, if you have a loop that runs through a sensor’s data buffer, you’re doing integer arithmetic to calculate the address of each element. Whetstone has routines that run large, nested loops with multi-dimensional integer arrays, incrementing indices, calculating offsets, doing bounds checks—all the things that trip up CPU pipeline prediction and integer unit throughput. I’ve seen a lot of cheap benchmarks just increment a single integer for index counting, but that doesn’t test the actual work of calculating where that index lives in memory. Whetstone makes you do that, and it varies the array sizes too, so you can’t just cache the entire array in L1 cache every time. That’s important because real software deals with data that’s too big for fast cache all the time.

Next up: integer arithmetic operations, not just adding and subtracting. Whetstone tests all the other stuff too, but with a twist. I see a lot of people write off multiply and divide as floating-point tasks, but modern CPUs have dedicated integer units for multiply and divide, especially the small, low-power cores my embedded clients use. Whetstone includes routines that do a ton of integer multiplication for things like scaling values, converting between units, and even simple cryptographic logic (though that’s a side effect, not a design goal). It also uses a lot of modulo operations, which are notoriously slow for many CPUs because they require division. For example, there’s a classic Whetstone routine that calculates Fibonacci numbers using only integer math, and it runs for thousands of iterations. Fibonacci uses repeated addition, multiplication, and modulo to keep numbers within a range, and it’s perfect for testing how a CPU handles long sequences of integer operations without branching too much (wait, no, Fibonacci has branching for the base cases—there’s that control flow I mentioned earlier). That routine is a workhorse for me when I’m showing clients that their integer units aren’t just for trivial adds.

Then there’s the part that a lot of new Whetstone users miss: integer control flow and conditional logic. Integer performance isn’t just about how fast you can do math—it’s about how well your CPU can follow the instructions. Whetstone is full of nested if statements, loops that break early, and switch cases, all using integer conditions. For example, there’s a routine that simulates a simple linear algebra solver, where you have to check if a value is above a threshold, adjust it, and keep going. Those conditional branches are integer operations too—comparing two integers, setting a flag, deciding where to jump next. Whetstone mixes these branches right in with the arithmetic, so you’re not testing math in a vacuum. I’ve had clients come to me after using a benchmark that only tests raw integer throughput, and their products fail in the field because their actual code has a mix of branches and math that Whetstone catches.

Wait, let’s get specific about how the benchmark is actually run for integer work. The standard Whetstone score is usually how many operations it does per second, right? But when you’re testing integer performance, you don’t run the full floating-heavy version—you tweak it, or use the integer-specific workloads that were added later (though the original suite has enough integer stuff if you know where to look). The original Whetstone suite has a section called “Simple Integer Operations” that’s just that, but it’s not a separate test—it’s baked into the overall execution. For example, when the benchmark initializes variables, that’s integer work. When it iterates through loops, counting steps, that’s integer. When it calls subroutines, passing integer parameters, that’s more integer. A lot of people run the whole suite, pull out the floating-point score, and ignore the integer part, but the integer work makes up like 30% of the total execution time in the original version. That’s a big chunk.

Let me give you an example from a recent job I did for a smart meter manufacturer. They had a microcontroller that ran at 32MHz, and they were comparing it to a competitor’s part. The competitor’s specs said their integer unit was 20% faster, but when they ran Whetstone, their integer score was only 5% higher. Why? Because the competitor’s benchmark test they were using only tested raw add speed, not the overhead of handling array indices and branches that the smart meter’s actual code uses to calculate energy usage. Whetstone caught that, because it’s not just counting how many adds you can do—it’s counting how many useful integer operations, the kind that matter for real code, you can do in a second. That’s the value of Whetstone for integer work, and why my clients keep coming back to me for calibrated Whetstone suites tailored to their hardware.

Another thing I’ve noticed over the years: Whetstone tests integer operations across different data widths. Most new benchmarks are focused on 64-bit integers now, but a lot of embedded systems still use 8-bit and 16-bit integers. The original Whetstone routines work with whatever integer width the compiler uses, and many ports have been modified to test specific widths. For example, when I supply a Whetstone suite for a client making a microcontroller for industrial sensors, I adjust the integer test to focus on 16-bit operations, since that’s what their code uses. If I was supplying a suite for a desktop CPU, I’d tweak it for 64-bit integers. Whetstone is flexible that way, which is why it’s been around for so long.

Wait, let’s talk about common misconceptions. A lot of people think Whetstone is outdated, that it doesn’t test modern integer operations like SIMD or vector integers. And yeah, the original suite doesn’t, but modern versions—like the Whetstone port for ARM NEON or Intel SSE—have been updated to include those, though most of my clients for embedded or low-power systems don’t care too much about SIMD. For their use case, scalar integer operations are what matter, and Whetstone nails that. The key here is that Whetstone is a real-world workload, not a synthetic one. It’s not just a loop that does 1000 adds—it’s a loop that does adds, multiplies, compares, branches, and accesses memory, all things that integer units deal with every single day.

Let me walk through a typical integer test run I do with a client. First, I set up the Whetstone suite on their hardware, compile it with their toolchain (I work with all the major compilers, so that’s never an issue). Then, I run three iterations to warm up the cache (you have to do that, otherwise you get skewed results), then run it for 10 seconds, capturing all the integer operations. I break down the score: how many array index operations, how many integer adds, how many multiplies, how many comparisons and branches. That breakdown is way more useful than a single number, because it tells us exactly where their integer performance is bottlenecked. Is it the multiply unit? The branch prediction? The memory system? Whetstone gives you all that, not just a single score.

I’ve had clients come to me panicking because their product is running slow, and we run Whetstone and find that their integer unit’s divide operation is 3x slower than the competitor’s. That’s a simple fix, just adjust their code to avoid divides where possible. If they’d used another benchmark that only tests add speed, they never would’ve found that problem. That’s the real value of Whetstone for integer work—it’s not just a test, it’s a diagnostic tool.

Now, I know I’ve been rambling a bit, but let’s circle back to the original question: how does Whetstone benchmark test integer operations? To sum it up, it doesn’t just test raw arithmetic speed. It tests the full picture of integer performance: the ability to calculate and access memory with array indices, handle different arithmetic operations (add, multiply, modulo) in realistic sequences, navigate conditional branches and control flow, work with different integer widths, and balance the load between the CPU’s integer unit, cache, and memory. It’s rooted in real software workloads, not synthetic stunts, which is why it’s stood the test of time.

If you’re a hardware designer, compiler developer, or embedded systems engineer looking for a reliable, practical way to test your integer operations performance, I can help you get set up with a calibrated Whetstone suite tailored to your specific use case. I’ve spent years refining these tests for all kinds of hardware, from 8-bit microcontrollers to high-end server CPUs, and I can provide you with accurate, actionable data, not just a generic score. Reach out to me to chat through your needs and get started.

SIC Products References:

  1. Curnow, H. J., & Wichmann, B. A. (1976). A synthetic benchmark. The Computer Journal, 19(1), 43-49.
  2. Weiss, A. (1995). A performance history of the Whetstone benchmark. ACM SIGARCH Computer Architecture News, 23(2), 172-178.
  3. Stone, J. E., & Tute, R. (2013). Performance evaluation of modern x86 and ARM processors using Whetstone and Dhrystone benchmarks. Proceedings of the 2013 IEEE International Symposium on Workload Characterization, 182-191.

Zibo Longshine International Co., Ltd​​​.
Zibo Longshine International Co., Ltd. is one of the most professional whetstone manufacturers and suppliers in China, specialized in providing high quality customized products. We warmly welcome you to buy high-grade whetstone at competitive price from our factory.
Address: No,7, Jinjie, Beijing Road, Zhangdian, Zibo, Shandong, China
E-mail: ding@zblongshine.com
WebSite: https://www.zblongshine.com/