I am starting to see more and more benchmarks that demonstrate ArrayList crushing LinkedList in terms of performance for 'large' inserts example below: Gluelist
Adding(1M) Elements (5 Tests Avg.)
LinkedList: 174.8 milliseconds
ArrayList: 76.4 milliseconds
GlueList: 39.2 milliseconds
Adding(10M) Elements (5 Tests Avg.)
LinkedList: 8975.6 milliseconds
ArrayList: 4118.2 milliseconds
GlueList: 3320.1 milliseconds
I ran similar tests on a RHEL 7.2 with JDK8.latest and saw similar results. I am under the impression that a LinkedList insert is O(1) even in the worst case and an ArrayList takes > O(1) because of the copy operation (I realize that we can discuss amortized costs, but that is out of scope). My question is this: How is LinkedList performing worse than ArrayList given that ArrayList forces a copy operation when capacity is nearly reached?