RFR: 8196340: (coll) Examine overriding inherited methods in ArrayList and ArrayList.SubList
Martin Buchholz
martinrb at google.com
Fri May 11 22:49:36 UTC 2018
Yet another microbenchmark coming your way. Embarrassing to have COWAL win
all these so handily.
--- IteratorMicroBenchmark.java 11 May 2018 18:19:10 -0000 1.45
+++ IteratorMicroBenchmark.java 11 May 2018 22:35:32 -0000 1.46
@@ -564,6 +564,12 @@
sum[0] = 0;
x.replaceAll(sneakyAdder);
check.sum(sum[0]);}}},
+ new Job(klazz + " equals") {
+ public void work() throws Throwable {
+ ArrayList<Integer> copy = new ArrayList<>(x);
+ for (int i = 0; i < iterations; i++) {
+ if (!x.equals(copy))
+ throw new AssertionError();}}},
new Job(klazz + " hashCode") {
public void work() throws Throwable {
int hashCode = Arrays.hashCode(x.toArray());
C2:
Method Millis Ratio
ArrayList equals 58 1.000
ArrayList$SubList equals 72 1.240
LinkedList equals 101 1.739
AbstractList$SubList equals 164 2.822
Vector equals 162 2.790
SynchronizedRandomAccessList equals 182 3.129
CopyOnWriteArrayList equals 22 0.394
COWSubList equals 19 0.336
C1:
Method Millis Ratio
ArrayList equals 300 1.000
ArrayList$SubList equals 389 1.297
LinkedList equals 328 1.094
AbstractList$SubList equals 349 1.162
Vector equals 263 0.876
SynchronizedRandomAccessList equals 395 1.314
CopyOnWriteArrayList equals 78 0.262
COWSubList equals 80 0.269
More information about the core-libs-dev
mailing list