Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Ruby: parallel processing made simple and fast

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
README.markdown
Rakefile
VERSION
parallel.gemspec

README.markdown

Run any kind of code in parallel Processes or Threads, to speedup computation by factor #{your_cpus} X.

  • child processes are killed when your main process is killed through Ctrl+c or kill -2

Install

sudo gem install grosser-parallel -s http://gems.github.com/

Usage

#i -> 0..number_of_your_cpus
results = Parallel.in_processes do |i|
  expensive_computation(data[i])
end

#i -> 0..4
results = Parallel.in_processes(4) do |i|
  expensive_computation(data[i])
end

#same with threads (no speedup through multiple cpus, but speedup for blocking operations)
results = Parallel.in_threads(4) do |i|
  blocking_computation(data[i])
end

Author

Michael Grosser
grosser.michael@gmail.com
Hereby placed under public domain, do what you want, just do not hold me accountable...

Something went wrong with that request. Please try again.