def fast_collect(collection, &block)
      collection.map do |item|
        Thread.new do
          Thread.current[:result] = block.call(item)
        end
      end.collect do |thread|
        thread.join
        thread[:result]
      end
    end
def fast_collect(collection, &block)
      collection.map do |item|
        Thread.new do
          Thread.current[:result] = block.call(item)
        end
      end.collect do |thread|
        thread.join
        thread[:result]
      end
    end
Quickly iterate over a collection using native Ruby threads, preserving
 the original order of elements and being all thread-safe and stuff.

 @example Parse a collection of JSON files

   fast_collect(Dir['**/*.json']) do |item|
     JSON.parse(File.read(item))
   end

 @param [#each] collection
   the collection to iterate
 @param [Proc] block
   the block to evaluate (typically an expensive operation)

 @return [Array]
   the result of the iteration