3 ms·
Iterators and other allocations in hot loops are not universally harmful to performance and footprint. Very often they are scalar-replaced (allocated on the sta
by pron 7y ago
Iterators and other allocations in hot loops are not universally harmful to performance and footprint. Very often they are scalar-replaced (allocated on the stack and reused)-- in fact, if they don't escape, they're almost certain to be. Escape analysis is also now significantly stronger and able to see through abstraction in JDK 14 thanks to increasing the default inlining depth from 9 to 15 (https://bugs.openjdk.java.net/browse/JDK-8234863 https://bugs.openjdk.java.net/browse/JDK-8234863).
- pjmlp 7y agoAgreed, but it depends very much on which JVM one is using, and not all of them offer the same capabilities as Hotspot. And then there is that other special flavour of coffee beans out there.