using all 121 lines of parallel.rb from MenTaLguY’s concurrent lib…
Before:
iwotw_photos.map do |photo|
[photo, photo.to_person_attributes]
end
$ time ./flickr_poller.sh real 0m18.643s user 0m2.060s sys 0m0.190s
After:
iwotw_photos.parallel_map(10) do |photo|
[photo, photo.to_person_attributes]
end
$ time ./flickr_poller.sh real 0m4.733s user 0m2.430s sys 0m0.180s
…though I’m not sure if flickr likes 10 calls at a time to the API :\