In your code you have:

(defstruct body
  :id
  :type ; :projectile or :unit -> projectiles do not collide with other
bodies;
  :current-position ; ref
  :current-cells  ; ref
  :current-rotation  ;atom
  :pixel-half-width :pixel-half-height
  :half-width :half-height
  :components) ; a map of (:comp-type comp)

It's discouraged to use the mutable reference types in a fine-grained way
like this. I would recommend changing your code to just be a vector of
Clojure PersistentMaps that you map over.  It seems that your program is not
so dissimilar from something that I worked on, you might want to look at
this code for some ideas how to improve the speed of your code:
http://github.com/swannodette/flocking/blob/master/src/flocking/flocking3.clj

When I first implemented this in early 2008 it was taking about 100-120ms to
update 150 "boids". This version can do it in about 6-8ms.

I also note that you're not type-hinting your math, but I'm unsure how much
that plays into the perf you're seeing.

David

On Fri, Apr 23, 2010 at 4:55 AM, msappler <damnedmar...@web.de> wrote:

> http://pastebin.com/Vv7xr6Uj

-- 
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