Run Ruby code in parallel processes, threads or Ractors
open sourceMITfree
parallel is a Ruby gem for running code in parallel: processes to use all CPUs, threads to speed up blocking operations, or Ractors. Parallel.map, each, each_with_index, map_with_index and flat_map take a collection and a block and spread the work across workers, which suits map-reduce jobs and parallel downloads or uploads.
Problems it solves
- run a Ruby loop across all CPU cores
- download many files in parallel from Ruby
- speed up a slow Ruby map with processes
Features
- parallel processes, threads or Ractors
- Parallel.map, each and flat_map
- choose the number of workers
