For those who are interested in Clojure performance, I've updated my
flocking example from earlier, which uses Roland's excellent Processing
library.
http://github.com/swannodette/clojure-stuff/blob/80035bb3b76c21d39d6f801aaaa1e9a27aa1116b/flocking.clj

It is twice as fast as the previous version and purely functional, no
reusing Java arrays or reusing PVector objects.

1. Use make-arrays wisely and it works well.
2. Do your math in Java (PVector in my case), Clojure's built in vectors
just aren't designed for it, which is FINE.
3. Type-hint very very very very agressively.  *warn-on-reflection* is a
life saver, thanks Rich.

It's still a bit slower (2X-3X) than the Processing version, but I prefer
the fact that this one is functional over the original, no changing vector
objects in place.

This pretty much as far as I can see it going down this path, it is pretty
much a direct translation of the Java version minus mutation, in the next
version I hope to incorporate some of the suggestions in reply to my earlier
post (FMM in particular).

David

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

Reply via email to