r/java • • Jan 22 '26

Java 26: what’s new?

https://www.loicmathieu.fr/wordpress/informatique/java-26-whats-new/

What's new in Java 26 for us, developers

(Bot in English and French)

163 Upvotes

43 comments sorted by

View all comments

Show parent comment

2

u/RussianMadMan Jan 23 '26 edited Jan 23 '26

I'd guess iterators (Iterable actually) are just slow. Its an interface so you have a hot loop with a virtual function call, that cannot be optimized out because it has to be polymorphic to work with every collection. Tho I would like to see the actual assembly generated.
So its a (virtual call + get a reference)*size vs allocate array + (get reference + write a reference)*size. I can see that after a certain size, time spent on virtual calls might be bigger than one allocation of an array and bunch of writes.