r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Feb 22 '15

[deleted]

13

u/slavik262 Feb 22 '15

Yep. Cache misses are a huge and "hidden" cost on modern CPU architectures. Everything being a heap-allocated object in Java means that unless you're iterating over an array of primitives, you're going to be doing a lot of bouncing around in memory. See: http://gameprogrammingpatterns.com/data-locality.html

1

u/nqd26 Feb 22 '15

Everything being a heap-allocated object in Java

But this is not really true anymore. Java does escape analysis (IIRC from Java 6 with some option, from Java 7 by default) and puts short-lived (i.e. those which don't escape method scope) objects on stack.