What's up anyway -

Jeremie Pelletier jeremiep at gmail.com
Thu Oct 15 07:59:10 PDT 2009


Justin Johansson wrote:
> downs Wrote:
> 
>> Justin Johansson wrote:
>>> - that the .sizeof a delegate is 8 bytes (on a 32-bit machine).
>>>
>>> AFAIK, stack pushes are still more expensive than a pointer dereference in contemporary
>>> CPU architectures.
>>>
>>> Justin
>> - with this weird way of writing posts? The subject should tell us about the content, not your emotional state! :p
> 
> Re subject line: fair call, you are right.  Emotions aside, at least this time I got a response.
> 
>> Also I have no idea what you mean. Should delegate _values_ be heap allocated?! That'd be insanity. Also, I'm fairly sure you're wrong. The stack is relatively likely to be in the CPU cache. A random pointer dereferencing .. isn't. Also, do you really want to heap even more work on the ailing GC?
> 
> I will be bold and say yes to off-stack allocation,
> whether that be in the general heap or other (and probably other to avoid an "ailing CG").

I don't see why delegates should be allocated on the heap, if so then 
dynamic arrays would have to too, because they're the same size.

It wouldn't be efficient because even if dereferences 'may' be faster 
than stack pushes, having arrays or delegates in the heap would double 
the number of dereferences needed, double the chances of memory not 
being in the cache and double the code to create and access them.

> When the tough gets going, the going have to get tough.
> (Meaning to start thinking outside of the square.)

And here I was trying to think outside of the tesseract :o)



More information about the Digitalmars-d mailing list