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

Ben Engbers ben@engber@ @end|ng |rom gm@||@com
Sun May 8 21:52:41 CEST 2022



Op 08-05-2022 om 21:15 schreef Joshua Ulrich:
> Hi Ben,
> 
> On Sat, May 7, 2022 at 4:24 PM Ben Engbers <Ben.Engbers using be-logical.nl> wrote:
>>
>> Hi,
>>

> 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."

This reminds me of Occams's razor ;-) If you have the choice between 
good working simple code or more complex code which might perform 
slightly better, the simple code is to be preferred.

I don't remember if it was because the package is based on R6 object 
orientation or if it was because the client is based on a client-server 
architecture. I do know that profiling did not add much information.

And a quick search for "R R6 profiling" shows that R6 applications 
cannot yet be examined using a profiler ;-(.

Ben



More information about the R-package-devel mailing list