Fredrik
4/16/2008 3:34:00 AM
There doesn't seem to be any EASY way of doing a parallel computation
in Ruby.
I would like to do something like this :
array.map do |i|
fork do
i + 1
end
end
Process.waitall
wich would give back the array with one added to each element in an
array, and it would perform this "calculation" in parallel. However,
this doesn't work since fork runs a subprocess which is another Ruby
interpreter and I can't get anything back from that black hole, except
some exit status.
Actually, it would be really nice if there was a 'forkmap' method that
could do this:
array.forkmap do |i|
i + 1
end
But there isn't, right?