On 24/08/12 16:41, nicolas.o...@gmail.com wrote:
(and creates vectors via (into [] (r/map ....)))
Depending of your method of scoring, you could try to do it just with a reducer.
(Without creating a vector with it).
but i am doing it with a reducer (the mapping) , however after that i
need to either count the pieces and subtract them (score-by-count), or
sum the relative-values for both teams and subtract that...in the first
case, i need a seq (need countability) - in the second case i'm using
r/reduce + .
basically the screenshot i posted was using the most realistic/expensive
scoring-fn (score-naive) which actually does not create any vectors!
Then what was the profiler showing? clojure.lang.PersistentVector$1 ?
what's with the inner class named "1"?
(defn score-by-count ^long [b dir]
(let [ hm (into [] (core/gather-team b dir))
aw (into [] (core/gather-team b (unchecked-negate dir)))]
(unchecked-subtract (count hm)
(count aw))))
(defn score-naive ^long [b dir]
(let [hm (core/gather-team b dir)
aw (core/gather-team b (unchecked-negate dir))]
(unchecked-subtract (r/reduce + (r/map :value hm))
(r/reduce + (r/map :value aw)))))
If your code does not spend its time in GC (can be seen in the first
pane), CPU sampling might be a better place to look.
well cpu sampling or profiling does not work...the other works but
limits cpu usage to 1 core! I don't think GC is a problem especially
after dropping the alive objects to 6,000 from 29,000...first pane you
mean the first tab yes - where it shows the graphs (bottom left graph)?
Jim
--
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