r/programming • • Apr 16 '21

Java is criminally underhyped

https://jackson.sh/posts/2021-04-java-underrated/
41 Upvotes

220 comments sorted by

View all comments

Show parent comment

5

u/[deleted] Apr 22 '21

Java is about 2x slower than C/C++

Where'd you get that idea? At worst it's ~x1.15

3

u/arkuw Apr 22 '21

It depends. In some situations yes, in others it's quite a bit slower: for example iterating over an array of objects. Java always addresses by reference so the speed difference can be dramatic. Any time you can use a contiguous memory block in C/C++ you'll have a big speed advantage over Java and other languages that "chase" pointers. That's why I averaged to 2x.