[concurrency-interest] Question: microbenchmarks sourcecodes

Joe Bowbeer joe.bowbeer at gmail.com
Mon Nov 26 16:27:19 EST 2007

On Nov 24, 2007 2:00 PM, Krzysiek Zaporowski wrote:
> I'm making microbenchmark that measures ReentrantLock vs synchronized.
> I've followed advices Brian Goetz presents in his articles, but still
> I'm receiving strange results - synchronized block seems to be pretty
> faster. So, now I'm in the point where I don't know what to correct in
> my benchmark to run it properly. Conceptually it's pretty similar to
> benchmark proposed by Brian Goetz and Tim Peierls - threads are
> receiving random numbers in synchronized or lock block.
> Are there any sourcecodes of microbenchmark proposed? Or maybe someone
> had done such benchmarks and could show me how to do this properly?

Note that synchronized performance has improved considerably since the
initial benchmark results were reported:

  Why is reentrant lock faster than synchronized?

Btw, are you referring to the following article?

  Java theory and practice: Anatomy of a flawed microbenchmark

Joe Bowbeer

More information about the Concurrency-interest mailing list