Another thing you might want to test is the fairness of the rw-lock in your RWDict, because even a couple of very active readers can easily starve out any number of writers when the rw-lock is non-fair. The reason is simple: readers can interleave but writers cannot, and writers can only get in when noone is reading :)
On Fri, Jan 16, 2009 at 4:21 AM, Stu Hood <stuh...@gmail.com> wrote: >> Ah! but a mere hash table is not bi-directional :-) > Right =) I got the idea in a Channel 9 video about MS' efforts with STM: > http://channel9.msdn.com/shows/Going+Deep/Software-Transactional-Memory-The-Current-State-of-the-Art/ > (which reminds me, the spin-lock approach they try is probably fairly close > to using an Atom in Clojure). > > I made the changes that Christophe suggested, and added type hints for the > HashMaps used in CLJDict, and the speed improvement is very impressive. To > see the scalability of the different approaches, I graphed with various > numbers of threads and read percentages: > http://github.com/stuhood/clojure-conc/tree/master/results > > Two conclusions: > 1. The overhead for STM with low contention is very reasonable, > 2. Optimism + MVCC + persistence fall down when faced with a majority of > writes. (see the 100% write case in the writes graph.) > > Thanks, > Stu > > > On Thu, Jan 15, 2009 at 2:52 PM, Christian Vest Hansen > <karmazi...@gmail.com> wrote: >> >> On Thu, Jan 15, 2009 at 8:47 PM, Christian Vest Hansen >> <karmazi...@gmail.com> wrote: >> > On Thu, Jan 15, 2009 at 8:35 PM, Mark H. <mark.hoem...@gmail.com> wrote: >> >> On Jan 15, 1:38 am, stuhood <stuh...@gmail.com> wrote: >> >>> The benchmark contains 4 bi-directional dictionary implementations: >> ... >> >> >> >> Doesn't Java already have a more optimized thread-safe hash table that >> >> works by locking individual buckets, rather than the whole table? >> >> Maybe I'm just confused ;-P >> >> Ah! but a mere hash table is not bi-directional :-) >> >> >> -- >> Venlig hilsen / Kind regards, >> Christian Vest Hansen. >> >> > > > > > -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~----------~----~----~----~------~----~------~--~---