On Dec 8, 2012, at 3:42 PM, Andy Fingerhut wrote:
> 
> I'm hoping you realize that (take 10000 (iterate reverse value)) is reversing 
> a linked list 10000 times, each time allocating 10000 cons cells (or 
> Clojure's equivalent of a cons cell)?  For a total of around 100,000,000 
> memory allocations of small objects per call to burn?
> 
> I know that this is just a bit of code for testing purposes, and not your 
> real application, but do you really do that quantity of memory allocation 
> versus arithmetic in your code (7*10,000 arithmetic operations for every 
> 10,000*10,000 memory allocations?)
> 
> I still believe there is an issue here with either the memory allocation or 
> garbage collection implementations that we are seeing here that can hopefully 
> be improved with some command line options to the JVM that I don't know yet, 
> but I know that I have seen much bigger speedups in code that didn't do this 
> much memory allocation versus non-allocating computation (e.g. the Computer 
> Language Benchmarks Game Clojure programs).

The numbers were guesses, but my real applications do have something of this 
flavor. Mostly I'm doing genetic programming, which involves generating, 
running, mutating and recombining programs. Population sizes are often in the 
thousands, with program sizes up to thousands of instructions/literals. Often 
the programs include list manipulation instructions so there's lots of memory 
allocation involved in executing them (in addition to the allocation required 
to generate and manipulate them).

 -Lee

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