Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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/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 :)


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: