I have couple interesting Java collections in my hand such as:
- http://code.google.com/p/guava-libraries/
- Java 7
- Java 7 concurrent collections
- Scala collections
- Homegrown collections that we have at some company
I wonder what would be the best practices to test开发者_开发知识库 these API's, from a performance and scalability perspective, i.e. which one is fastest, most scalable, performant, etc. Should I set with million(s) of random elements and use timer or something else? Just wanted to satisfy my curiosity and see which one would win.
Edit: JMH is better nowadays
Check out Caliper. It will be having its 1.0 release this fall, but many people are already using it with good results (by building it from source; sorry).
Glance over some of the ScareText at https://github.com/google/caliper/wiki/JavaMicrobenchmarks, though.
There's a white paper on somebody benchmarking Java collections. I didn't see any source code, though.
精彩评论