Is there a way to avoid "deep data copy" when calling a function within foreach() %doPar% ?

Within a given process, R is actually quite good about not making unnecessary copies. With foreach, of course, we are creating additional processes, and each of those processes requires its own copy of the data it is working on. If those individual processes only require a portion of the data, you can optimize the computations to pass only the required data. (Extract the subsets in the master process, then pass just those to the workers.) But no, the .export options in foreach() won't help a great deal.
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.
Properties

Article ID: 3103816 - Last Review: 11/01/2015 14:06:00 - Revision: 1.0

Revolution Analytics

  • KB3103816
Feedback