Some performance questions

Chris Nicholson-Sauls ibisbasenji at gmail.com
Mon Feb 2 12:11:24 PST 2009


Jarrett Billingsley wrote:
> On Mon, Feb 2, 2009 at 1:27 PM, grauzone <none at example.net> wrote:
>> Why not use scope to allocate the class on the stack?
>> For everything else, I agree with Donald Knuth (if he really said that...)
> 
> That's fine too, and would fit in with his needs to implement
> interfaces.  But again, if he's worried about caching some parameters
> but not worried about the overhead of virtual calls.. something's off.

Or he's caching some very big/complex parameters in the code he's 
actually writing... maybe. That said: do we have any assurance that, 
were the functor class tagged as 'final', the call would cease to be 
virtual?  If so, then the only extra cost on the call is that of the 
hidden "this" sitting in ESI.  I still don't care for the memory 
allocation involved, personally, but if these are long-lived functors 
that may not be a major problem.  (Ie, if he calls foo(?,X) a million 
times, the cost of allocating one object is amortized into nearly nothing.)

-- Chris Nicholson-Sauls


More information about the Digitalmars-d-learn mailing list