Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Conway's Game of Life implementation in various languages
PHP JavaScript Ruby CSS
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
javascript More optimisations and updating README file with updates performance …
php
ruby
.gitignore
README.textile

README.textile

Multi-language implementations of Conway’s Game of Life

The goal is to provide near identical implementations of Conway’s Game of Life in multiple languages to measure not only the speed of the language, but for each person to assess the syntax of each, and the ease and availability of unit testing tools.

I started with the Ruby implementation, optimised it as much as I could, and then ported it to the other languages. Therefore, some languages may not be running as fast as they possibly could. Any suggestions for optimisations that can be translated to each implementation are greatly appreciated (minimal language specific optimisations please).

Speed Results (by tick time)

Note 1: These speed results are taken on a 13", Late 2011 Macbook Pro, 2.8 GHz Intel Core i7, with 4 GB of 1333 MHz DDR3 RAM.

Note 2: The times were calculated by playing each simulation for a few thousand ticks until the game stopped moving and the average stabilised.

Place Language Tick Time Render Time % slower Notes
1st. Javascript 0.00511s 0.00334s SpiderMonkey 31 (Firefox 33)
2nd. Javascript 0.00670s 0.00230s 131.1% (1.31x) V8 3.28.71.15 (Chrome 38.0.2125.104)
3rd. Ruby 0.00770s 0.00730s 150.6% (1.50x) Ruby 2.1.2
4th. PHP 0.02718s 0.00918s 531.8% (5.31x) PHP 5.4.30
Something went wrong with that request. Please try again.