Hi Ken, Thanks for the comment. I tried what you suggested, but I am not getting any reflection warnings. That said, comments like this are exactly what I am looking for; I had no idea that you could turn on checking for reflection issues. I'd love it if I could find a way to speed this piece of code up, but, at the end of the day, what I am really interested in is learning all the different ways that good Clojure programmers go about analyzing their code for performance issues. So, thanks a bunch for the tip and, please, keep them coming.
Christopher On Jul 8, 4:17 pm, Ken Wesson <[email protected]> wrote: > On Fri, Jul 8, 2011 at 7:05 PM, Christopher <[email protected]> wrote: > > ;; mapper.clj > > > (use ['clojure.java.io :only '(reader)]) > > (use ['clojure.string :only '(split)]) > > > (defn mapper [lines] > > (doseq [line lines] > > (doseq [word (split line #"\s+")] > > (println (str word "\t1"))))) > > > (mapper (line-seq (reader *in*))) > > Try (set! *warn-on-reflection* true) at your REPL and then evaluating > the above. One of the commonest causes of slow Clojure performance is > reflection, which can generally be avoided with judicious application > of type hints. > > -- > Protege: What is this seething mass of parentheses?! > Master: Your father's Lisp REPL. This is the language of a true > hacker. Not as clumsy or random as C++; a language for a more > civilized age. -- 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
