Hello Vincent, Vincent Foley a écrit : > Hello, > > For the past few days, I've been trying, unsuccessfully, to make an > application I wrote faster. A Java program that performs, more or > less, the same task takes 12 seconds (on my machine) to parse 1000 > files; my Clojure program takes nearly 3 minutes. This more than an > order of magnitude slower! Using the profiling tools available with > the JVM, I quickly determined which function was the costliest. I > copied it into a simple script file to profile it in isolation. I > have made the script and the profile results (long!) available at this > URL: http://gist.github.com/82136 >
On my box nearly one half of the total time is sepent in the building of arr (and by looking at your profiling data a good chunk of these traces are related to this map call). Better to get it out of the loop. (let [arr (into-array Byte/TYPE (map byte [7 ; 1 Byte 3 0 97 0 98 0 99 ; 3 Shorts 0 0 100 100 ; 1 Integer 65 66 67 68 69 70 71 72 73 74 ; 10 String 0 0 0 0 0 0 0 0 0 0 ; 10 ignored ])) buf (ByteBuffer/wrap arr)] (time (dotimes [_ 10000] (.position buf 0) (run buf)))) Can you give the profile results for this code? Christophe -- Professional: http://cgrand.net/ (fr) On Clojure: http://clj-me.blogspot.com/ (en) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---