4 ms·
Streams are questionable in performance vs non-stream approaches. I haven't found an article that details performance differences, but I will say that I persona
by zatkin 11y ago
Streams are questionable in performance vs non-stream approaches. I haven't found an article that details performance differences, but I will say that I personally tried doing things using streams and doing the same things using non-streams and have had mixed results, one being faster than the other in some cases.
- mabbo 11y agoThe benefits of streams isn't performance improvements for the CPU, but performance improvements for the developer.
- chii 11y agoi have colleges that claim streams don't necesserily make the code more readable. Imagine a triple nested for-loop - making it a triple nested streams (e.g., where your map method is yet another stream), doesn't seem to really make it any more readable. The only reason to use streams, i think is the possibility to automatically parrelize, and secondarily to make it more readable.
- mabbo 11y agoI would take any triply-nested for loops, and reduce each loop to its own method. Inside that method would be nice, easy-to-understand stream logic rather than for-loops. The Java compiler will unroll the methods anyways, so you get easy readability without any loss of performance.