Home
Blog
Reasons to Add a Benchmark Command
Updated
Dot Net Perls

Reasons to Add a Benchmark Command

Usually when a program becomes big and complex enough (and important enough) it has some features that are slow. If left alone, the slowness will often become annoying. One thing I like to do in console programs is provide a hidden benchmark option.

When writing articles, I make many spelling errors so I have a spelling checker. Because of the quantity of text it must process, the spell-checker must be optimized. By providing a benchmark command, which causes the program to repeat the spell-checking many times, I can make sure the speller is kept in good condition.

Here are some benefits of using a hidden benchmark option:

The benchmark code can stay in place, and it can be safely ignored during normal use.
The benchmark is technically a micro-benchmark, but it is run within another program so it has more normal memory use.
When I am bored, I can run the benchmark and see if anything needs fixing.

Programs often last for many years, if they are useful. Even though a hidden benchmark command is still a micro-benchmark, which causes distortions in the results, it is still worth doing as it can highlight any regressions and give some motivation.

Dot Net Perls is a collection of pages with code examples, which are updated to stay current. Programming is an art, and it can be learned from examples.
Donate to this site to help offset the costs of running the server. Sites like this will cease to exist if there is no financial support for them.
Sam Allen is passionate about computer languages, and he maintains 100% of the material available on this website. He hopes it makes the world a nicer place.
An RSS feed is available for this blog.
Home
Changes
© 2007-2025 Sam Allen