Giter Site home page Giter Site logo

gameoflife's Introduction

GameOfLife

Naive implementation of a Game of Life, to experiment with Repa. http://en.wikipedia.org/wiki/Conway's_Game_of_Life

This example is a simple show case of Repa (https://hackage.haskell.org/package/repa). It shows how easy it is to switch from sequential to parallel computation with this package.

The tests I performed on the "example/test.gif" file, with 150 iterations, show a significant performance improvement with 4 cores (+RTS -N4 -s).

  • With 1 Core: 22.57s
  • With 4 Cores: 7.19s (about 3.1 times faster)

Command line argument used (where x stands for the number of cores): examples/test.gif examples/test_out.gif 150 +RTS -Nx -s

Further testings

I noticed that collecting the last image only (instead of collecting all images to produce the animated gif) had for effects:

  • To make the program run in constant space (with 8.6 MB maximum residency).
  • To make the program more scalable in terms of parallelism.

Using the same machine, I got the following results:

  • With 1 Core: 21.97s
  • With 4 Cores: 6.07s (about 3.6 times faster)

It shows that Repa takes real good advantage of multiple cores (from 1.1 millions pixels/s to 3.95 millions pixels/s).

gameoflife's People

Contributors

quentinduval avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.