Parallel processing in Crystal
Parallel.each(1..10) do |x|
# CPU heavy task...
puts x
end
Parallel.each(['a', 'b', 'c']) do |x|
# CPU heavy task...
puts x
end
Add this to your application's shard.yml
:
dependencies:
parallel:
github: hugoabonizio/parallel
require "parallel"
TODO: Write usage instructions here
TODO: Write development instructions here
- Fork it ( https://github.com/hugoabonizio/parallel.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
- [hugoabonizio] - creator, maintainer