Search code examples
javaperformancetestingbenchmarking

Java: Difference between macro and micro benchmarks


I was reading about benchmarks and came across these terms. I'm not clear as to their exact meaning. From my understanding, a micro-benchmark, benchmarks a very small functionality of the app. In Java programming, an example would be a performance of HashMap. Macro benchmarks are more on an application level, based on what customer requirements are. Following my example, a Macro benchmark would be to benchmark an Caching application.

Can anyone shed more light on this and verify whether what I have understood is right?


Solution

  • Your explanation just about covers it:

    Summery provided by Rachasatish and taken from his blog1

    Micro-benchmarks (repeatable sections of code) can be useful but may not represent real-world behavior. Factors that can skew micro-benchmark performance include Java virtual machine warm-up time, and global code interactions.

    Macro-benchmarks (repeatable test sequences from the user point of view) test your system as actual end users will see it.

    This again is taken from the following book chapter2:

    • Chapter 3, "Measurement Is Everything" of "Java Platform Performance". Author Steve Wilson and Jeff Kesselman, Publisher Sun.

    1 which is quite an exhaustive blog article (i.e. a long list with a summary of every topic) about "Java performance tuning tips"

    2 which is where the original link seemed to be pointing to