[concurrency-interest] ReadMostlyVector vs CopyOnWriteArrayList

Markus Krainz ldm at gmx.at
Wed Feb 13 07:27:04 EST 2013


I have a question regarding ReadMostlyVector from the jsr166e package. I 
had a look at the sourcecode and it uses StampedLock, for which some 
impressive benchmarks results have been reported on this. For it's use 
cases it seems pretty similar to CopyOnWriteArrayList. There are some 
subtile differences from the API docs. The CopyOnWriteArrayList iterator 
does not reflecting changes, while the ReadMostlyVector will reflect 
them on a best effort basis (if snapshotIterator() is not used). 
CopyOnWriteArrayList's cow might have higher memory overhead. When 
should we use ReadMostlyVector in preference to CopyOnWriteArrayList?

Thanks and best regards,
Markus Krainz


More information about the Concurrency-interest mailing list