From pgilbert at bank-banque-canada.ca  Wed Feb 16 19:13:36 2011
From: pgilbert at bank-banque-canada.ca (Paul Gilbert)
Date: Wed, 16 Feb 2011 18:13:36 +0000
Subject: [Rd] function call overhead
In-Reply-To: <AANLkTimdA=ExqfGGVuzk703PAs2eMcU_87rj1fydccx-@mail.gmail.com>
References: <4d5b98ec.4c02cc0a.13fe.476c@mx.google.com>
	<AANLkTimdA=ExqfGGVuzk703PAs2eMcU_87rj1fydccx-@mail.gmail.com>
Message-ID: <6441154A9FF1CD4386AF4ABF141A056D21525F40@WMEXOSCD2-N1.bocad.bank-banque-canada.ca>

(subject changed from: RE: [Rd] Avoiding name clashes: opinion on best practice naming	conventions)

Dominick

Is this really true? Is there a speed advantage to defining a local function this way, say, within another function, and then calling it within a loop rather than the original? Do you have data on this?

Paul

> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> project.org] On Behalf Of Dominick Samperi
> Sent: February 16, 2011 12:44 PM
... 
> Since the resolution of myPkg::foo() occurs at runtime (via a function
> call) instead
> of at compile time (as it would in C++), this practice can introduce a
> significant
> performance hit. This can be avoided by doing something like:
> mylocalfunc <- myPkg::foo
> [tight loop that uses mylocalfunc repeatedly]
> 
> Here mylocalfunc would not be exported, of course.
> 
> Dominick
...
====================================================================================

La version fran?aise suit le texte anglais.

------------------------------------------------------------------------------------

This email may contain privileged and/or confidential information, and the Bank of
Canada does not waive any related rights. Any distribution, use, or copying of this
email or the information it contains by other than the intended recipient is
unauthorized. If you received this email in error please delete it immediately from
your system and notify the sender promptly by email that you have done so. 

------------------------------------------------------------------------------------

Le pr?sent courriel peut contenir de l'information privil?gi?e ou confidentielle.
La Banque du Canada ne renonce pas aux droits qui s'y rapportent. Toute diffusion,
utilisation ou copie de ce courriel ou des renseignements qu'il contient par une
personne autre que le ou les destinataires d?sign?s est interdite. Si vous recevez
ce courriel par erreur, veuillez le supprimer imm?diatement et envoyer sans d?lai ?
l'exp?diteur un message ?lectronique pour l'aviser que vous avez ?limin? de votre
ordinateur toute copie du courriel re?u.


[Rd] function call overhead
Paul Gilbert