Thanks, seems that I misunderstood Agents :)

The solution of Christian works well with full load, but maybe slow for the
benchmark. In my core2duo, with full load, takes about 28mins to compute the
result.

user=> (do (println (System/nanoTime)) (start 50000000))
22651751153117
#<ag...@27a897a9: 1>
user=> 292 ( 24319344452689 )
user=> (/ (- 24319344452689 22651751153117) 60000000000.0)
27.793221659533334


2009/5/29 Christian Vest Hansen <karmazi...@gmail.com>

>
> On Fri, May 29, 2009 at 4:29 PM, Laurent PETIT <laurent.pe...@gmail.com>
> wrote:
> > when I try it with the 50,000,000 number of times the token is
> > exchanged (which is the number to be used for the benchmark)
>
> Oh, right. I only noticed the 1000 mentioned at the bottom. Also, the
> (time ...) makes no sense.
>
> > How would one fix this?
>
> With a CountDownLatch? That's what I'm currently trying.
>
> >
> > 2009/5/29 Christian Vest Hansen <karmazi...@gmail.com>:
> >>
> >> For kicks, I made an implementation* using agents:
> >>
> >> http://gist.github.com/119946
> >>
> >> I think that you may not want to use the STM so much and instead
> >> figure out a different approach to sending the token around the ring.
> >>
> >> *it may be a bit liberal in its interpretation of the rules... didn't
> >> read them that carefully.
> >>
> >> On Fri, May 29, 2009 at 2:32 PM, Alvaro Vilanova Vidal <
> alv...@gmail.com> wrote:
> >>>
> >>> Hi everyone,
> >>> I am a newbie in clojure world, so I have some newbie's questions :) To
> >>> learn about clojure, I am trying to do the thread ring problem of clgb
> in
> >>> clojure. The rules of problem are here, and my attempt here. It seems
> that
> >>> works well, but I can only test it with a small load (5 - 15 threads,
> 503 is
> >>> the target) because it runs extremely slow. I tried to use atoms,
> hints, and
> >>> change the implementation, but always is slower. What am I doing wrong?
> And,
> >>> by the way, why can't I compile the class?
> >>>
> >>> Thanks a lot.
> >>>
> >>>
> >>> >
> >>>
> >>
> >>
> >>
> >> --
> >> Venlig hilsen / Kind regards,
> >> Christian Vest Hansen.
> >>
> >> >
> >>
> >
> > >
> >
>
>
>
> --
> Venlig hilsen / Kind regards,
> Christian Vest Hansen.
>
> >
>


-- 
Álvaro Vilanova,
http://alvivi.com

--~--~---------~--~----~------------~-------~--~----~
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
Note that posts from new members are moderated - please be patient with your 
first post.
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to