Dear Bert, Thanks for your reply... So> cmpfun(mclapply)should do the job right? By the by, how can I give a reprex? Reprex of the code that I am giving to mclapply (as FUN argument)? Yours sincerely, AKSHAY M KULKARNI ________________________________ From: Bert Gunter <bgunter.4567 at gmail.com> Sent: Wednesday, July 6, 2022 10:32 PM To: akshay kulkarni <akshay_e4 at hotmail.com> Cc: R help Mailing list <r-help at r-project.org> Subject: Re: [R] byte coding compiling..... Unlikely See here: https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/ Byte code compilation should be automatic in both cases, as I understand it. Of course, I could be wrong due to special features of parallel programming, etc. A reprex might be helpful here. Cheers, Bert On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni <akshay_e4 at hotmail.com<mailto:akshay_e4 at hotmail.com>> wrote: Dear members, I am using pbmclapply, the progress bar version of mclapply, from the parallel package. The point is, pbmclapply is three times faster than mclapply, and I think the most probable reason would be that pbmclapply is byte code compiled (I can think of no other reason). I know the cmpfun function from compiler package. If I do:> cmpfun(mclapply)will the job be done? The point is mclapply may look for other functions in the parallel package. So I have to compile the whole package right? How do you do that? or in general, how do you byte code compile a whole package? Thanking you, Yours sincerely, AKSHAY M KULKARNI [[alternative HTML version deleted]] ______________________________________________ R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see 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. [[alternative HTML version deleted]]
A reprex is a minimal example that performs as you described. It is up to you to trim your code down to eliminate irrelevant computation while not eliminating the described behavior. You may discover something about your own code in the process that answers your question, or you will be able to demonstrate the issue, or we may still not be able to reproduce if it is related to your system. On July 6, 2022 10:54:18 AM PDT, akshay kulkarni <akshay_e4 at hotmail.com> wrote:>Dear Bert, > Thanks for your reply... > >So >> cmpfun(mclapply) > >should do the job right? > >By the by, how can I give a reprex? Reprex of the code that I am giving to mclapply (as FUN argument)? > >Yours sincerely, >AKSHAY M KULKARNI >________________________________ >From: Bert Gunter <bgunter.4567 at gmail.com> >Sent: Wednesday, July 6, 2022 10:32 PM >To: akshay kulkarni <akshay_e4 at hotmail.com> >Cc: R help Mailing list <r-help at r-project.org> >Subject: Re: [R] byte coding compiling..... > >Unlikely > >See here: > https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/ > >Byte code compilation should be automatic in both cases, as I understand it. Of course, I could be wrong due to special features of parallel programming, etc. > >A reprex might be helpful here. > >Cheers, >Bert > > >On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni <akshay_e4 at hotmail.com<mailto:akshay_e4 at hotmail.com>> wrote: >Dear members, > I am using pbmclapply, the progress bar version of mclapply, from the parallel package. The point is, pbmclapply is three times faster than mclapply, and I think the most probable reason would be that pbmclapply is byte code compiled (I can think of no other reason). > >I know the cmpfun function from compiler package. If I do: > >> cmpfun(mclapply) > >will the job be done? The point is mclapply may look for other functions in the parallel package. So I have to compile the whole package right? How do you do that? or in general, how do you byte code compile a whole package? > >Thanking you, >Yours sincerely, >AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see >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. > > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >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.-- Sent from my phone. Please excuse my brevity.
On 06.07.2022 19:54, akshay kulkarni wrote:> Dear Bert, > Thanks for your reply... > > So >> cmpfun(mclapply)mclapply is already byte compiled as it is in a package. You may want to cmpfun(yourFunction) the function that you use in the mclapply call. Best, Uwe Ligges> > should do the job right? > > By the by, how can I give a reprex? Reprex of the code that I am giving to mclapply (as FUN argument)? > > Yours sincerely, > AKSHAY M KULKARNI > ________________________________ > From: Bert Gunter <bgunter.4567 at gmail.com> > Sent: Wednesday, July 6, 2022 10:32 PM > To: akshay kulkarni <akshay_e4 at hotmail.com> > Cc: R help Mailing list <r-help at r-project.org> > Subject: Re: [R] byte coding compiling..... > > Unlikely > > See here: > https://www.r-bloggers.com/2017/08/how-to-make-best-use-of-the-byte-compiler-in-r/ > > Byte code compilation should be automatic in both cases, as I understand it. Of course, I could be wrong due to special features of parallel programming, etc. > > A reprex might be helpful here. > > Cheers, > Bert > > > On Wed, Jul 6, 2022, 7:29 PM akshay kulkarni <akshay_e4 at hotmail.com<mailto:akshay_e4 at hotmail.com>> wrote: > Dear members, > I am using pbmclapply, the progress bar version of mclapply, from the parallel package. The point is, pbmclapply is three times faster than mclapply, and I think the most probable reason would be that pbmclapply is byte code compiled (I can think of no other reason). > > I know the cmpfun function from compiler package. If I do: > >> cmpfun(mclapply) > > will the job be done? The point is mclapply may look for other functions in the parallel package. So I have to compile the whole package right? How do you do that? or in general, how do you byte code compile a whole package? > > Thanking you, > Yours sincerely, > AKSHAY M KULKARNI > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org<mailto:R-help at r-project.org> mailing list -- To UNSUBSCRIBE and more, see > 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. > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.