Nevermind, kindly ignore my last post ;-) You called it. The map
inside my decode function returns a lazy seq, and it was being
accessed on-demand by the doseq towards the end of the program. To
make matters worse, I was consuming the agents in a serial fashion
completely eliminating any parallel processing. After the change, it
runs in 5 seconds on four cores as opposed to 15 seconds on a single
core. Thank you for taking the time to help me with this. It's been a
learning experience.

Travis

On Jun 15, 8:22 pm, tmountain <tinymount...@gmail.com> wrote:
> Completely omitting work-buckets and spawn-agents, I've replaced with
> the following, but the CPU still sits at 100% usage, and the run time
> is still ~15 seconds.
>
> (def work-units (doall (for [x (range 15)]
> "88148433eeb5d372c0e352e38ac39aca")))
> (def agents [(agent work-units)
>              (agent work-units)
>              (agent work-units)
>              (agent work-units)])
>
> ; send each agent a job to do
> (doseq [agent agents]
>        (send agent decode))
>
> ; wait on the agents to complete their jobs
> (apply await agents)
>
> ; see the results
> (doseq [agent agents]
>         (doseq [result @agent]
>          (println result)))
>
> ; clean up
> (shutdown-agents)
>
> On Jun 15, 7:06 pm, Richard Newman <holyg...@gmail.com> wrote:
>
> > Try doall:
>
> >http://clojure.org/api#toc216
--~--~---------~--~----~------------~-------~--~----~
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