plasmo wrote:
I have a Life program running on 128x64 OLED display of my recently designed 6502 SBC. It is a simple program without complicated tables or compression; it also operates at the same speed whether the screen is blank or full of life. I'm curious about the speedup of XLife algorithm which I'm not familiar before reading your post. On a 14.7MHz 6502, my simple Life algorithm takes 158mS per generation, or 6.3 generations per second. Part of the overhead is the bit-bang I2C interface which paints the entire 128x64 screen each generation. It takes 42mS to bit bang a screen, so with better screen update hardware, the simple Life algorithm may be as fast as 116mS/generation. However, since the 128x64 screen is smaller than your example of 126x108, to scale up the problem proportionally would mean the simple algorithm may take 194mS/generation or 5.1 generations/second. Looking at your table for 6502 at 1.11MHz and scale it up to 14.7MHz gives 37.7 generations/sec. So my simple algorithm has great deal of room for improvement, like 7 times!
As for comparing Z80 to 6502, the simple Life program is also running on Z80 and I found 6502 is faster than Z80 clock-for-clock, around 1.8 times faster. This is may be a reflection of my Z80 programming skill (18 months of experience) to my 6502 skill (newbie at 2 weeks of experience).
Thank you for your report. Your skills for the Z80 are definitely better than for the 6502.
Usually for the 6502:z80 speed ratio we have about 2.5 for high optimized code. The Xlife algorithm is not the best but it is still among the best. Its main advantage is its ability to work with unlimited grid. Its good performance is based on intensive usage of lookup tables. They are tens of kilobytes in original Xlife and they can be gigabytes in the newest Xlife, but Xlife-8 is optimized for 8 bit computers and uses rather smal tables several KB in size. The best GoL algorithm known to me which calculates all grid every pass is one realized in Tomas Rokicki's Life program. It is freely available and inspired some ppl to make their own Life implementations on its base. IRC this algorithm can be about 3 times faster than the Xlife algo for completely filled grids. So it is about 21 times faster than your current implementation. However if you use large patterns they usually do not fill all grid space and Xlife can be faster in those cases. A single glider movement should be also faster in Xlife, than in Tomas Rokicki's Life. For example, Xlife-8 for the Commodore+4 in screen blank mode (the 6502 works at 1.7 Mhz in this case) makes about 290 generations a second for such a single glider.