If you change the size of your CA, is the ( java time / clojure time ratio )
roughly constant ?

2010/5/28 Rubén Béjar <rbe...@unizar.es>

> 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 some work I have something that
> works, but it is pretty slow. The function that takes a CA
> of 500x500 cells (integers) and returns an updated (*) copy
> takes 4 s. (using Clojure vectors), while doing more or less the same in
> Java (using arrays and primitive types) takes more or
> less 16 *ms.*. I expected some difference, but not that big. Before
> trying to use Java arrays and primitive types
> in Clojure, I would like to know how my Clojure approach can
> be improved  (I am willing to sacrifice some performance to keep
> it "more Clojure", but not that much).
>
> As I do not want to post a bunch of horrible code full of comments
> and not properly indented, I have extracted what i hope are the
> main pieces, written some comments and posted it here:
> http://snipt.org/Okpk
>
> Pasting that code in a new file in Eclipse (I am using
> counterclockwise) and running it in the REPL prints this:
>
> Clojure 1.1.0-alpha-SNAPSHOT
> "Elapsed time: 4355.363706 msecs"
> "Elapsed time: 4416.98562 msecs"
> 1:1 user=> #<Namespace cellular-automata-basic>
> 1:2 cellular-automata-basic=>
>
> I would thank a lot any hint, suggestion, comment, or
> whatever... :-)
>
> Best regards,
>
>   Rubén
>
> (*) The update consists on adding the values of the 8 neighbours
> of every cell and changing it if that sum is between two fixed
> numbers.
>
> --
> Rubén BÉJAR HERNÁNDEZ
>
> Dpto. de Informática e Ingeniería de Sistemas - Universidad de Zaragoza
> (Computing and Systems Engineering Department - Universidad de Zaragoza)
> c/ María de Luna 1, 50018 Zaragoza, Spain
>
> Tel: (+34) 976 76 2332 (Fax: 1914)  e-mail: rbe...@unizar.es
>
> Grupo IA3 (IA3 Laboratory) - http://iaaa.cps.unizar.es
>
>
>
> --
> 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<clojure%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

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