GC allocation

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 21 18:55:36 PDT 2016


On Thursday, 21 April 2016 at 22:59:58 UTC, Alex wrote:
> Ok... I make slices of them, carefully avoiding to make 
> copies...

Yeah, that shouldn't make a difference..

> Huh? I think, this is the place, where I lack some 
> background... So, I bind my delegates via

Can you post any more of your code?

>     return iota(delegatesAmount).map!(a => (MM p) => 
> .dDelegate(a, p));

This would indeed allocate a new heap block for each one, but 
there might be other ways to do it.

> Yes. I'm sure the object is alive till the very end. As 
> mentioned above, do you think it is worth to make a struct to 
> save a result from iota?
> Nevertheless, my intention here is speed, so a fast solution is 
> much better, then any slow one, even if the speed gain is 10% 
> only... But the construction effort is almost negligible.

I don't know yet, if construction is allowed to be slower, what 
you have is fine though.



More information about the Digitalmars-d-learn mailing list