Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including distributed-game-of-life with all npm packages installed. Try it out:

var distributedGameOfLife = require("distributed-game-of-life")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

distributed-game-of-life v1.0.0

GOL(game of life) done in distributed manner


Run your js in multithreaded!. Harness up to 100% CPU power. GOL done in distributed manner,


Install node and npm, node-gyp, bower and git, then:

npm i --save gol npm start and wait till 10 workers will do the job

change first line of index.js to use 2 workers and observe that it takes twice more time to calculate the world

##Benchmark of calculations of game of life

10 workes
vs 100times x 2xrecalculate x 100xpartsOfWolrd
1: 6617ms
1: 5957ms
1: 5870ms
1 worker (single thread)
vs 100times x 2xrecalculate x 100xpartsOfWolrd
1: 22223ms
1: 23846ms
1: 24604ms


generally on 4 actual cores one can expect speedup of 3.9 times


Change first line from 10 to 2 workers and run the script

you know the drill

    git clone
    npm install
    node index.js
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free