Re: Realtime Clojure program

2011-02-16 Thread Marko Topolnik
> That's not even an API change -- it's a compiler change. An improved > API behavior would be making nth work on sorted-sets and sorted-maps. > ;) True, I guess -- even though, with a LISP it's not obvious where API ends and language starts -- (let) is, after all, a clojure.core macro :) -- You

Re: Realtime Clojure program

2011-02-16 Thread Ken Wesson
On Wed, Feb 16, 2011 at 3:36 AM, Marko Topolnik wrote: >> HOFs and >> lazy seqs add a bit more expense. Try deliberately throwing an >> exception in lazy-seq and then (first (map this (map that ... >> (my-exception-throwing-lazy-seq and see how deep the stack trace >> nests; the method call ov

Re: Realtime Clojure program

2011-02-16 Thread Marko Topolnik
> HOFs and > lazy seqs add a bit more expense. Try deliberately throwing an > exception in lazy-seq and then (first (map this (map that ... > (my-exception-throwing-lazy-seq and see how deep the stack trace > nests; the method call overheads do add up when there's many of them! Tell me about i

Re: Realtime Clojure program

2011-02-15 Thread Ken Wesson
On Tue, Feb 15, 2011 at 10:02 AM, Marko Topolnik wrote: >> > Is really any call that isn't inlined that expensive? >> >> Yes, unfortunately. You saw the numbers. :) > > If you mean the earlier thread about the Euler problem, I see that the > diagonal-sum-3 drastically outperforms diagonal-sum-2 by

Re: Realtime Clojure program

2011-02-15 Thread Marko Topolnik
> > Is really any call that isn't inlined that expensive? > > Yes, unfortunately. You saw the numbers. :) If you mean the earlier thread about the Euler problem, I see that the diagonal-sum-3 drastically outperforms diagonal-sum-2 by eliminating HOFs and working with unchecked primitive ops. Elimi

Re: Realtime Clojure program

2011-02-15 Thread Ken Wesson
On Tue, Feb 15, 2011 at 3:52 AM, Marko Topolnik wrote: >> 4. Unless you're using 1.3 or later, put the innermost loop in a >> single function and try to avoid calling sub-functions, except for >> operators like + that can get inlined. > > This is interesting, can you be more specific about this po

Re: Realtime Clojure program

2011-02-15 Thread Marko Topolnik
> 4. Unless you're using 1.3 or later, put the innermost loop in a > single function and try to avoid calling sub-functions, except for > operators like + that can get inlined. This is interesting, can you be more specific about this point -- what exactly do we need to avoid? Calls that force the

Re: Realtime Clojure program

2011-02-14 Thread Joost
On Feb 14, 4:32 pm, cej38 wrote: > Laziness is great when there are things that may not ever be needed. > But it slows things down when you know that you are going to need some > function applied to every element of some col.  The doall function is > your friend in this case. AFAIK, most if not a

Re: Realtime Clojure program

2011-02-14 Thread cej38
Laziness is great when there are things that may not ever be needed. But it slows things down when you know that you are going to need some function applied to every element of some col. The doall function is your friend in this case. If there are things that you are using pmap on then I would op

Re: Realtime Clojure program

2011-02-14 Thread Adam Burry
On Feb 13, 7:50 pm, Jarl Haggerty wrote: > I'm shooting for 60 fps but I can barely get 10 when the box is > falling and when it lands on the ground and the collision response > kicks in I get about 5. > > The project has reached a size where I thought it would be silly to > ask for specific way

Re: Realtime Clojure program

2011-02-14 Thread Ken Wesson
On Sun, Feb 13, 2011 at 5:50 PM, Jarl Haggerty wrote: > For a while I've been working on a 2D physics engine written in > Clojure.  I just recently got to the point where I can run a > simulation(a box falling onto the ground) and it is painfully slow. > I'm shooting for 60 fps but I can barely ge

Realtime Clojure program

2011-02-14 Thread Jarl Haggerty
For a while I've been working on a 2D physics engine written in Clojure. I just recently got to the point where I can run a simulation(a box falling onto the ground) and it is painfully slow. I'm shooting for 60 fps but I can barely get 10 when the box is falling and when it lands on the ground an