Hi, While looking into ArrayDeque::addElements recently, I noticed that the copy constructor ArrayDeque(Collection) does not specialize for an ArrayDeque being passed in a similar fashion to what ArrayList does.
By utilizing the ArrayListBulkOpsBenchmark and adopting it for ArrayDeque, I was able to test the performance impact of specializing ArrayDeque(Collection) for ArrayDeque. Results show a reduction in time/op ranging from 30% (1 element) to 75% (75 elements). I also experimented with a similar specialization for ArrayList which shows promising results, up to 50% faster for lists of size 75. However, there are many collections in the JDK and which combinations to specialize for is not obvious. Is further exploration here worthwhile? Cheers, Eirik.
