- Notifications
You must be signed in to change notification settings - Fork1
syzer/distributed-game-of-life
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
#WAT
JS implementation of all time favorite game of life.Game Of Life -> link
Run your game of life on multicore.
... wait what?..... js multicore?.. what madness is that?
YES. that's right:Run your js in multithreaded!. Harness up to 100% CPU power.
SimplyGOL done in distributed manner.
#HOW
Install node and npm, node-gyp, bower and git,then:
npm i --save gol
npm start
and wait till other thread(s) will do the job
Then change first line ofindex.js
to use 2 or even 10 workers/threads,and observe how much time to calculate whole game changes.
##Benchmark of calculationsof game of life
10 workers (threads)vs 100times x 2x recalculate x 100xpartsOfWolrd1: 6617ms1: 5957ms1: 5870ms
1 worker (single thread)vs 100times x 2xrecalculate x 100xpartsOfWolrd1: 22223ms1: 23846ms1: 24604ms
Generally on 4 actual cores one can expect speedup of 3.9 timesSo short answer... yes it does.
- If my math is right we only display 1 millionth part of world.
- You can always write mote effective GOL, and then run it multicore.
- If you do.. remember to Pull Request me, so otheres can enjoy.
#HOW
Change first line from 1 to 2 or even 10 workers and run the script.Observe how the speed of world generation changes....Isn't that exiting?If you feel particularly adventurous, you might even go for 50 threads.Do not worry.. they are quite light weight.
Installation:you know thedrill
....
git clone cd npm install node index.js
cat docs/multicore_all_things.txt
tested on mac & windows
Need volunteer to run it in Linux!