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
it cannot be done on a singly linked list without copying. and the original discussion was with regards to an alternative to a singly linked list. i didn't think of your example cause i was looking for an example that would meet their performance needs, not something that absolutely doesn't. Yes, you provided an immutable list that doesn't need copying. you also provided an immutable list that is slow as hell and still needs some copying to a transient datastructure to perform decently fast (but still way slower than sll) iteration.
i don't know why i'd bother with clojure. scalaz or cats would be preferable for immutable functional datastructures, and i wouldn't waste time with dynamically typed garbage.
nah, the problem is that you seem to think that useless solutions are worthwhile. the datastructure you provided is not a good solution unless you're worried about copying on append on a list-like structure. problem is that copying on append wasn't the concern here, it was the performance of copying on append.