Micro-benchmarks

When we want to focus on the efficiency of some particular language feature or programming style, as opposed to the overall efficiency of some large and complicated program, we often use small micro-benchmarks. Because they are small, we can design them to emphasize the particular feature or style of interest. Because they are small, it is easier to avoid confounding problems. Because they are small, it is easier for programmers to read them when deciding whether the comparison is fair.

The danger of micro-benchmarks is that, being small, they are not representative of typical programs. It would be a mistake to say compiler A is better than compiler B on the basis on one micro-benchmark, or even several micro-benchmarks. It would be a mistake to say language X is faster than language Y on the basis on one micro-benchmark, or even several micro-benchmarks.

By design, micro-benchmarks can only tell us about the language feature or programming style whose efficiency they were designed to measure.

Many micro-benchmarks don't even do that.

For debugging: Click here to validate.