Maps and Sets

9 views
Skip to first unread message

Sciss

unread,
Jun 25, 2010, 4:51:17 AM6/25/10
to scala...@googlegroups.com
hi,

what is the purpose of THashMap... i guess it is just for performance reasons? because i use a lot of Ref[ collection.immutable.Map ] and Ref[ collection.immutable.Set ] instances, and they seem to be working fine.

best, -sciss-

Nathan Bronson

unread,
Jun 25, 2010, 11:19:35 AM6/25/10
to scala...@googlegroups.com
THashMap allows for concurrency. With Ref[immutable.HashMap] the unit
of conflict checking is the entire map; if two txns both want to update
the map they can't run at the same time. With THashMap the unit of
conflict checking is an individual entry, so the txns can happily run in
parallel so long as they don't conflict on a particular key.

The idea behind THashMap is part of my PhD thesis, in case you're
interested in how it works. THashSet, and sorted variants are coming to
CCSTM.

http://ppl.stanford.edu/papers/podc011-bronson.pdf

- Nathan

Daniel Spiewak

unread,
Jun 25, 2010, 11:55:31 AM6/25/10
to scala...@googlegroups.com

  http://ppl.stanford.edu/papers/podc011-bronson.pdf

Well, there goes my weekend!  :-)

Daniel
Reply all
Reply to author
Forward
0 new messages