Re: Newbie question about vector performance

2010-06-11 Thread David Nolen
On Sun, May 30, 2010 at 3:49 PM, Rubén Béjar wrote: > Thanks to all of you for your interest, I will inform of any further > advance... > :-) > > Rubén Because I like sitting around optimizing Clojure code I looked into this some more: http://gist.github.com/420036 With the really great cha

Re: Newbie question about vector performance

2010-05-31 Thread David Nolen
On Sun, May 30, 2010 at 3:49 PM, Rubén Béjar wrote: > > is not very precise with that short periods of time) and in Clojure the > 2000x2000 CA > is updated in 98 secs some times and up to 150 s. other times (the 500x500 > was 4 secs), When numbers fluctuate like that I'm pretty sure you're hitt

Re: Newbie question about vector performance

2010-05-31 Thread David Nolen
On Fri, May 28, 2010 at 12:20 PM, Rubén Béjar wrote: > Hi again, > > I have tried a few more things: > > I have done the same in Java but using an array > of Integers, instead of an array of ints. It just takes > 78 ms. (more than 16, still far less than 4 secs). > > I have also tried with an up

Re: Newbie question about vector performance

2010-05-30 Thread Rubén Béjar
Michael Gardner wrote: As a style issue I'd suggest using inc, dec, neg?, pos?, and zero? instead of the various (+ x 1), (< x 0), etc. in your code. This actually seems to improve performance a bit on my laptop, but it's nothing amazing. To get good performance you're likely going to need to

Re: Newbie question about vector performance

2010-05-29 Thread Laurent PETIT
If you change the size of your CA, is the ( java time / clojure time ratio ) roughly constant ? 2010/5/28 Rubén Béjar > Hi all, > > I am new to the list and to Clojure. I have been working in > implementing some 2D cellular automata (CA) just to have a project > to teach Clojure to myself. After

Re: Newbie question about vector performance

2010-05-29 Thread igorrumiha
On May 28, 3:47 pm, Rubén Béjar wrote: > > I would thank a lot any hint, suggestion, comment, or > whatever... :-) > Here is a version that is approx 10 times faster: http://snipt.org/Olml The code structure is basically the same but it uses integer arrays for storage, some manual inlining and lo

Re: Newbie question about vector performance

2010-05-28 Thread Luke VanderHart
I can't see your code due to the IT policies here, but I can make some generalizations - these are assuming your code is correct and you're not accidentally using an exponential algorithm (which I wouldn't preclude, 4 minutes does sound truly excessively slow, even for vectors). Vectors are signif

Re: Newbie question about vector performance

2010-05-28 Thread Michael Gardner
On May 28, 2010, at 8:47 AM, Rubén Béjar wrote: > I would thank a lot any hint, suggestion, comment, or > whatever... :-) As a style issue I'd suggest using inc, dec, neg?, pos?, and zero? instead of the various (+ x 1), (< x 0), etc. in your code. This actually seems to improve performance a b

Re: Newbie question about vector performance

2010-05-28 Thread Rubén Béjar
Hi again, I have tried a few more things: I have done the same in Java but using an array of Integers, instead of an array of ints. It just takes 78 ms. (more than 16, still far less than 4 secs). I have also tried with an update function which just returns a fixed 1. It still takes some