3 ms·
It is worse in Java. The standard LinkedList class in Java stores references to the data, not the data, in nodes, so there is more pointer chasing.
by mcculley 6y ago
It is worse in Java. The standard LinkedList class in Java stores references to the data, not the data, in nodes, so there is more pointer chasing.
- sltkr 6y agoThis applies equally to ArrayList.
- mcculley 6y agoYes, but if you can use ArrayList, you can also use an array. If you want to be able to remove an object from the middle without moving objects around, you have no choice other than LinkedList and the extra references.
- pjmlp 6y agoFor the time being, value types will eventually fix that. Ironically some of the ideas how to proceed with value types integration were already present in Eiffel, but so are design decisions.
- xirbeosbwo1234 6y agoSo do arrays. You can never have an "inline" object. It's always a reference. Java has another problem because each node is an object, though. Every object has (I believe) about 16 bytes of overhead. That will double the size of each node.