To give an example, I tried running through the Iliad from project
gutenberg, it's roughly 1MB of text http://www.gutenberg.org/files/6130/6130.txt

and the program takes ~4600 ms to run, if I comment out printing of
results it runs in ~3700 ms.
By contrast a java version runs in ~560ms.

Now, obviously I could just use the mutable java hash map, but I'm
curious if there's a functional approach which would be efficient.

On Dec 13, 12:38 pm, Jeremy Dunck <jdu...@gmail.com> wrote:
> On Dec 13, 9:41 am, Dmitri <dmitri.sotni...@gmail.com> wrote:
> ...
>
> > The slowdown seems to occur in the inc-count
> > function, where it "updates" the map using the assoc. Is this not a
> > proper way to approach this in clojure?
>
>             (recur (time (inc-count words head)) tail))))
>
> You're pretty tightly looping here-- are you sure the overhead isn't
> in this extra (time) call rather than (inc-count) itself?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to