Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Performance with Streams?

 
Saleem Lakhani
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any performance gains for using the new Streams in java 8?
 
Richard Reese
author
Ranch Hand
Posts: 84
5
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saleem,

There can be but you need to be careful. Streams can be processed either sequentially or concurrently. On small streams, processing them concurrently may take more time than doing them sequentially. You also want to make sure that a stream processed concurrently does not introduce errors. This can occur when there are “sequential” dependencies that can affect the results.

With that said, streams can result in better performance. Better yet, they are easier to build and understand than using more traditional manual multiple threading approaches.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49774
69
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch
Some people have waited longer than ten years before their first post.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic