On 26/08/12 11:03, Joshua Ballanco wrote:
I would love to have some time to look into the details of your specific
problem more, but in the absence of time, might I suggest two quick
points:

Well, feel free to have a look at the project on github when you find some time ( https://github.com/jimpil/Clondie24)...I should clarify that the big problem is with chess and not any other games...I'm expecting games like checkers or tic-tac-toe to perform just fine with the functional solution.

1. Gary Bernhardt has been playing with a "new" approach he calls
"Functional Core, Imperative Shell". Essentially, it's another take on
the question of how to limit the scope of mutation in order to get the
most out of the correctness of mutation-free algorithms and the
performance of mutating data instead of replicating it.

hmmm...I will definitely check this out...It is certainly an important issue!

2. Along the same lines, have you made the most out of transients in
your code? From your description, it seems like you have less work
happening within methods than between methods, but perhaps if you
"manually" inline some of the work, transients could provide improved
performance

well, transients do play an important role in my core 'move' fn which used to create 2 extra vectors as a result of 2 'assoc's...I got a 15% performance increase by using them despite of only mutating 2 indices! I cannot really use them anywhere else though...as far as inlining goes, most of my core fns that are involved in moving (which happens a lot) are 'definline'd and the fn that translates the position from 1d to2d and vice-versa (also called very frequently) is memoized....personally I cannot think of any other optimisations...the best suggestion so far was by Nicolas who basically proposed to precalculate all the pieces moves (apart from pawn) in a big table (a nested map) instead of calculating them on the fly...this made a bid difference! before that, the profiler was showing 86% core.logic.Subsitutions!!!!

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

Reply via email to