Microbenchmarks in Java, C# and C
These lecture notes explain how to design and run credible
microbenchmarks in Java, C# and C, and develop a simple microbenchmark
framework for each language, motivating each complication that needs
to be added to it. The notes also give several examples of using the
framework to measure the speed of built-in functions, the scalability
of sorting algorithms, the latency of various levels of the CPU memory
hierarchy, and so on. It also provides advice on simple plotting of
benchmark results, on identification of the experimental platform, and
on some professional benchmarking frameworks.
The most recent version in PDF.
The full source code is available under MIT License:
Bibliographic reference: Peter Sestoft: Microbenchmarks in Java, C#
and C. Lecture notes, version 1.0. IT University of Copenhagen, August
2026.
Peter Sestoft (sestoft@itu.dk) 2026-08-10