Hi Claes!
One thing I can't figure out is why both these two checks are necessary:
1303 checkForComodification();
1304 root.checkForComodification(expectedModCount);
The former compares the current root.modCount with the one at the time
this subList was created.
The later one compares the current root.modCount with the one at the
time the method was called.
If the later fails, wouldn't it imply the former should also have failed?
With kind regards,
Ivan
On 5/11/18 4:48 PM, Claes Redestad wrote:
Anyhow, this is the current state of things:
http://cr.openjdk.java.net/~redestad/8196340/open.01/
I think the remaining difference between ArrayList$SubList and COWAL
is down to the comodification checks in the former eating up too much
inlining budget, but haven't had any luck yet.
/Claes
On 2018-05-12 01:29, Claes Redestad wrote:
Good, this demonstrates the gain from specializing o.getClass() ==
ArrayList.class, which is most of the speed-up here as well as in my
own micro:
Patched:
Method Millis Ratio
ArrayList equals 17 1.000
ArrayList$SubList equals 108 6.312
CopyOnWriteArrayList equals 67 3.942
Baseline:
Method Millis Ratio
ArrayList equals 139 1.000
ArrayList$SubList equals 133 0.956
CopyOnWriteArrayList equals 59 0.429
Even without peeling I think we should be able to make ArrayList and
ArrayList$SubList equals as fast as COWAL, so I'll investigate why
they still differ.
/Claes
On 2018-05-12 00:49, Martin Buchholz wrote:
Yet another microbenchmark coming your way. Embarrassing to have
COWAL win all these so handily.
--- IteratorMicroBenchmark.java11 May 2018 18:19:10 -00001.45
+++ IteratorMicroBenchmark.java11 May 2018 22:35:32 -00001.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
--
With kind regards,
Ivan Gerasimov