Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

GOL done in distributed manner

NotificationsYou must be signed in to change notification settings

syzer/distributed-game-of-life

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 golnpm startand 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.

'but its so slow?'

  1. If my math is right we only display 1 millionth part of world.
  2. You can always write mote effective GOL, and then run it multicore.
  3. 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

Documentation

cat docs/multicore_all_things.txt

tested on mac & windows

Need volunteer to run it in Linux!

About

GOL done in distributed manner

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp