I added a Clojure implementation based on an Atom instead of a Ref,
and re-ran the tests (this time on a quad core machine). I also fixed
the calculation of the percent change in both tests (ugh).
It looks like using an Atom is slightly more performant than a Ref if
you are making a single state
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 wh
> 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
On Thu, Jan 15, 2009 at 8:47 PM, Christian Vest Hansen
wrote:
> On Thu, Jan 15, 2009 at 8:35 PM, Mark H. wrote:
>> On Jan 15, 1:38 am, stuhood wrote:
>>> The benchmark contains 4 bi-directional dictionary implementations:
...
>>
>> Doesn't Java already have a more optimized thread-safe hash tab
On Thu, Jan 15, 2009 at 8:35 PM, Mark H. wrote:
>
> Welcome to the group! :-)
>
> On Jan 15, 1:38 am, stuhood wrote:
>> The benchmark contains 4 bi-directional dictionary implementations:
>> * MDict - Java implementation using the synchronized keyword,
>> * RWDict - Java implementation using a
Welcome to the group! :-)
On Jan 15, 1:38 am, stuhood wrote:
> The benchmark contains 4 bi-directional dictionary implementations:
> * MDict - Java implementation using the synchronized keyword,
> * RWDict - Java implementation using a ReadWriteLock,
> * CLJDict - Clojure implementation using
stuhood a écrit :
> Hey gang,
>
> First time poster!
>
> I figured the best way to explore the interesting parts of Clojure
> (for me: STM, Java interop) would be to implement a simple locking
> problem in Java and Clojure, and pit them against eachother. The
> results are about what I expected, b
Hey gang,
First time poster!
I figured the best way to explore the interesting parts of Clojure
(for me: STM, Java interop) would be to implement a simple locking
problem in Java and Clojure, and pit them against eachother. The
results are about what I expected, but I'm sure you all can tell me