Hiya. Just for fun I was wanting to see what speed difference would come from doing Conway’s game of Life multi threaded vs single threaded. I’m using a naive implementation where I keep a front and back buffer and swap between these as I process. I didn’t want to implement any clever hashing or dead space detection since I’m interested in seeing the difference threading makes, not in implementing the fastest algorithm.
The results I got were these:
Single threaded: 28 million cells/sec
Multithreaded (4 cores): 40 million cells/sec
So that’s about a 30% increase. Now, I’ve never seen huge speed increases by multithreading and I think my CPU is pretty shit for multithreading (intel Q6700) so I wasn’t too surprised but there was one thing I was wondering about which I couldn’t find any definitive information about. The approach I’m taking is to get each thread to render 1/4 of the data. What I was wondering is whether there is any penalty getting each thread to write into the same array? I had assumed that as each thread writes to a different area in the array then that should not suffer any kind of slow down due to the threaded access. Is that correct?
Thanks!