From: Erik Veenstra Date: 2008-08-02T23:35:03+09:00 Subject: Re: Running methods in parallel ------=_Part_15026_13500308.1217687765588 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline > is there a way to parallelize ruby methods? Have a look at ForkAndReturn [1,2]. ForkAndReturn implements a couple of methods that simplify running a block of code in a subprocess. The result (Ruby object or exception) of the block will be available in the parent process. Here's an example: [1, 2, 3, 4].concurrent_collect do |object| 2*object end # ===> [2, 4, 6, 8] This runs each "2*object" in a seperate process. Hopefully, the processes are spread over all available CPU's. gegroet, Erik V. - http://www.erikveen.dds.nl/ [1] http://www.erikveen.dds.nl/forkandreturn/doc/index.html [2] http://rubyforge.org/projects/forkandreturn/ ------=_Part_15026_13500308.1217687765588--