4 ms·
Did some profiling with gliders using Conway's rules. To compute the next generation of 100 gliders takes 480 ms To compute the next generation of 1000 gliders
by dxbydt 14y ago
Did some profiling with gliders using Conway's rules.
To compute the next generation of 100 gliders takes 480 ms
To compute the next generation of 1000 gliders takes 5 s.
So, scales linearly.
stepper( nbrs _, List(3).contains _, List(2,3).contains _)( (1 to 1000).toList.map( x=> List((x-1,x),(x,x),(x+1,x))).flatten)
I guess if you replace the default collection ( List of Lists ) with a powerful sparse double matrix ( http://acs.lbl.gov/software/colt/api/cern/colt/matrix/impl/SparseDoubleMatrix2D.html http://acs.lbl.gov/software/colt/api/cern/colt/matrix/impl/S... ), you could eke out some gains...if you rewrote map and intersect and filter and flatten and contains and...ahhh that's just too much work :)