3 ms·
A lot of the clever helpers like that in Java unfortunately often trigger extra allocations, making them slower, as the above post implied.
by nitwit005 7y ago
A lot of the clever helpers like that in Java unfortunately often trigger extra allocations, making them slower, as the above post implied.
- cle 7y agoIndeed, and they are even worse than that, because Streams in Java can even be parallel streams and be processed by a thread pool. So it’s not enough to know that it’s a Stream, you have to know what kind of Stream, and if it’s a parallel Stream, what threadpool is it using? How big is it? What else uses it? What’s the CPU and memory overhead of the pool? What happens when a worker thread throws an exception? Etc. These are all hidden by the abstraction but are usually things we always care about as consumers of the abstraction.
- apta 7y agoThe introduction of value types in the JVM should hopefully alleviate this.