On Aug 30, 10:16 am, Armando Blancas <[email protected]>
wrote:
> > It seems like the loop/recur is non-idiomatic for this usage and could
> > be done with either a map or reduce.
>
> It could be that it's faster that way. How does you code perform?
Timings on this code for all three:
(time (count (map re-matches (cycle [#"[-+]?[0-9]+/([0-9])+" #"([-+]?
[0-9]+)/([0-9])+" #"[-+]?[0-9]+/[0-9]+" #"hamster"]) (take 200000 (for
[x (range) y (range x)] (str x "/" y))))))
clojure.core:Elapsed time: 668.029589 msecs"
first rewite: "Elapsed time: 887.169178 msecs"
multi-method: ""Elapsed time: 2632.672379 msecs"
Which begs the question: Is writing "idiomatic clojure" going to be
generally slower? Are there things that can be done to increase the
performance of the other 2 implementations?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en