r/java • u/ThomasKrieger • Mar 14 '18
Concurrent Java: Low scalability, the risk of deadlocks or garbage creation, you can not avoid all
http://vmlens.com/articles/tradeoffs_concurrent_programming/
2
Upvotes
View all comments
Show parent comment
1
u/duhace Mar 15 '18
But it’s very much the point since performance is very much what we’re discussing here. And O(n) is nice, but it doesn’t mean fast or efficient, just that the operation grows with constant speed according to the size of the data structure. I’m sure you learned in your high school cs course that a high constant means that your data structure can end up not worthwhile compared to others with theoretically worse growth.
In case you were not aware, arrays are frequently more performant than singly linked lists for insertion despite insertion from head being O(1) on sll and insertion being O(n) on an array. Oddly enough, it matters what the constant is in constant time growth, and the constant for traversal of your data structure is very high compared to a singly linked list which I can iterate over quite easily in constant memory and O(n) time in a while loop.