What are the benefits of doing code benchmarks?
- What are the benefits of doing code benchmarking? It’s a very different way of working than the one that most people are used to. Our industry is full of big hairy metrics, and when you start to dig down into the details, it’s a lot more complicated than it seems. Some things are very hard to measure, and when you look at the details of how they’re being measured, it’s not clear that they’re actually useful.
- There’s a famous graph from the book The Mythical Man-Month, which shows how much time it takes to design, test, and fix a bug. It has a hockey stick shape, where fixing a bug is much, much more expensive than writing the code in the first place.
- That’s the way that most people think about the software development process. They think of it as this process where you write code, then you have to test it, and then you have to fix the bugs. As a result, you have this curve that’s very expensive to fix bugs.
- But in reality, it’s not that simple. We actually don’t know how much time it takes to design and test a simple patch. The reason is that when you’re writing code, you don’t have to wait for a manager to give you permission. You don’t have to wait for a QA department to give you permission. You’re just hacking away, and then you commit your code, and it’s out there.
- If you make a mistake, it might be a small mistake, but if you make a small mistake early on, that’s a big problem because it’s going to be harder to fix. The reason is that you have to change more code. If it’s a big mistake, then people will just reject the code.
- If you make a small mistake in the beginning, and you fix it, that’s not a big deal. But if you make lots of small mistakes during the project, it’s a big problem, because you have to change everything.
- So it’s actually the mistakes that you make in the beginning that are the most expensive.
- That’s why it’s so important to write tests for your code as you’re writing the code. It’s because when you make a mistake, you need to fix it right away, because that’s the least expensive time to fix it. If you make a lot of mistakes during the length of the project, then you can just throw away the code and rewrite it from scratch.
- If you have a test suite, and you make that mistake, you can go back and fix it right away. You don’t have to wait for a manager or QA department to give you permission.
- That’s a much more efficient way of working. It’s more efficient because it’s not just about writing code faster. It’s also about making fewer mistakes in the first place.
Build better, faster software
Benchmark your Java stack, code, 3rd party libraries, APIs.Get Started