>>>>> "JC" == Jon Clayden <jon.clay...@gmail.com> >>>>> on Wed, 12 Aug 2009 14:57:10 +0100 writes:
>> > Dear all, >> > The version of readBin() in R-devel includes a use of match(), through >> > `%in%`, which can affect its performance significantly. By using >> > primitives instead of the rather expensive call to match(), I reduce >> > the time spent inside readBin() by more than 30% in some of my code >> > (part of the tractor.base package). A simple patch that does this is >> > given below. This passes "make check-devel" fine, and I don't see that >> > it could produce unexpected behaviour -- though I may, of course, be >> > wrong. >> >> actually, %in% is liked by programmeRs for its inherent >> robustness combined with "expressiveness" (<-> readability) >> inspite of its potential efficiency loss wrt to '==' JC> Oh, absolutely. I like it and use it widely. But my feeling was that JC> in core code, a small loss in expressiveness for a significant JC> performance improvement is a trade worth making. Yes, I agree, and hence the following ... >> and indeed, your patch fails in one case where the original code works: >> >> readBin(., NA_character_, ...) >> >> However that case can also be checked explicitly, >> and I will implement the corresponding patch. now in R-devel, revision 49187. JC> Many thanks. JC> Regards, JC> Jon Thank *you* ! {I forgot to say the first time ..} Martin ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel