Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 562
Chander Shivdasani Avatar asked Feb 01 '12 22:02

Chander Shivdasani


People also ask

What is a micro benchmark?

Micro-benchmarking is simply measuring the performance of a small piece of code. It is where sound methodology meets statistical prowess meets deep JVM knowledge. All three components are important to empirically evaluate the performance of a piece of code; otherwise, garbage in, garbage out.

Why use Microbenchmark?

Why Microbenchmarking is important. Microbenchmarks deal with the smallest of all benchmarks, and they represent a very simple and easy-to-define metric that tracks and measures the performance of a small and specific piece of code.


1 Answers

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

like image 79
Dmitri Avatar answered Sep 17 '22 23:09

Dmitri