Sunday, November 9, 2014

Java 8 ‘Stream’ Performance Test


I have been recently testing out new features in JDK8. I think one of the most interesting feature which is available other than Lamda is Stream (java-doc). In summery it gives you a good way to do functional style of programming on Java collection, also it has something extra, it allows you to run operations in serial or parallel which in return allows developers to easily code parallel programming without needing to worry about complex programming logic.

I wanted to test the Stream performance for that I’m going to use a simple loop counter (source-code)

1) Normal (Serial)

2) Synchronized Object reference (Parallel)

3) Synchronised Array reference (Parallel)

4) Atomic (Serial)

5) Atomic (Parallel)

6) Stream (Serial)

7) Stream (Parallel)

8) If the Developer puts in the effort

Following is the results when running it from my laptop


As you can clearly see, a good developer can right a fast code, but its a game between Simplicity vs Performance.


  1. Thanks for sharing such informative article on Loadrunner Automation testing tool. This load testing tool will provide most precise information about the quality of software. Loadrunner training in Chennai

  2. Here is one faster implementation: with performance test result:

  3. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you! gostream

  4. Glad to know that important information about that OEE Software , it is very useful about that. So thanks a lot for giving that useful topic.