画像処理を1スレッドでやるとCPUが余るので並列化する。
windows xpで使えるかテスト→使えた。
parallelの参考:
http://subtech.g.hatena.ne.jp/secondlife/20110927/1317123109
require 'rubygems'
require 'parallel'
require 'open-uri'
urls = [
'http://distilleryimage2.s3.amazonaws.com/c1a76e7805e411e2952122000a1d0298_6.jpg',
'http://distilleryimage2.s3.amazonaws.com/897a23e205e411e2b0c912313b089111_6.jpg',
'http://distilleryimage8.s3.amazonaws.com/c96bb6be05e411e2890222000a1cfddf_6.jpg',
'http://distilleryimage11.s3.amazonaws.com/bfeb634605e411e28ca012313804a021_6.jpg',
'http://distilleryimage2.s3.amazonaws.com/3411a89405e411e29bac22000a1c032a_6.jpg',
]
results = Parallel.map(urls, :in_threads => 5) {|url|
puts "download: #{url}"
body = open(url).read
puts "downloaded: #{url}"
body
}