It's sad, but not an impossible result with synchronization overhead (though I wouldn't have guessed it would be that bad) -- can you try it on a more reasonable benchmark?
Also, that advice might be somewhat out of date -- why not use the tools provided in library(parallel) available for recent versions of R? Michael On Thu, Jul 26, 2012 at 8:00 AM, deep123 <deps_...@yahoo.co.in> wrote: > Hello all, > My problem is similar to Sergey's. > I could not try what Mario suggested, since doMPI is not available for > windows. > > I have tried the Cedrick's commands, i.e. > cl.tmp = makeCluster(rep("localhost",2), type="SOCK") > registerDoSNOW(cl.tmp) > > but this is instead increasing the time taken. For Sergy's set of commands, > i get, >> x <- numeric(10000) >> system.time(for(i in 1:10000) x[i] <- sqrt(i)) > user system elapsed > 0.03 0.00 0.03 >> system.time(system.time(x <- foreach(i=1:10000, .combine="c") %do% >> sqrt(i))) > user system elapsed > 4.71 0.00 4.71 >> system.time(system.time(x <- foreach(i=1:10000, .combine="c") %dopar% >> sqrt(i))) > user system elapsed > 7.35 1.07 127.06 > > i.e. %dopar% is taking longer than %do% > > Please guide me. > > > > -- > View this message in context: > http://r.789695.n4.nabble.com/Parallel-computing-on-Windows-foreach-tp2256082p4637925.html > Sent from the R help mailing list archive at Nabble.com. > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.