[R-pkg-devel] Searching examples in source code

Joshua Ulrich jo@h@m@u|r|ch @end|ng |rom gm@||@com
Sun May 8 21:15:57 CEST 2022


Hi Ben,

On Sat, May 7, 2022 at 4:24 PM Ben Engbers <Ben.Engbers using be-logical.nl> wrote:
>
> Hi,
>
> My package (RBaseX) is written entirely in R. The performance is not bad
> but to further improve the performance I want to investigate to what
> extent use of C++ makes sense. Problem is that I have little experience
> with C++ and none with Rcpp. So I am looking for examples.
> On my (linux) system I installed several packages that needed to be
> compiled. So it is likely that I already have examples on my system.
>
I strongly recommend you profile your code to determine where there
are performance bottlenecks before writing any new code. Especially
before adding compiled code to your package.

The infamous Knuth quote:
"We should forget about small efficiencies, say about 97% of the time:
premature optimization is the root of all evil. Yet we should not pass
up our opportunities in that critical 3%. A good programmer will not
be lulled into complacency by such reasoning, he will be wise to look
carefully at the critical code; but only after that code has been
identified."

Best,
Josh

> My first question is if there is a useful linux command to search all
> the source code of installed packages on my system.
> The second question is if there is a command to search all packages at
> https://cran.r-project.org/web/packages/available_packages_by_name.html?
>
> This question is not only relevant to C++ examples. It would also be
> nice if you could search for occurrences of commands in R code.
>
> Ben
>
> ______________________________________________
> R-package-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-package-devel



-- 
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com



More information about the R-package-devel mailing list