deprecated delete and manual memory management

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 28 12:40:23 PDT 2011


On Thu, 28 Apr 2011 15:27:16 -0400, Timon Gehr <timon.gehr at gmx.ch> wrote:

> Steven Schveighoffer wrote:
>> Yes, the allocation and free performance could be improved, but it  
>> doesn't
>> change the fact that delete manually is not a huge performance gain, if  
>> at
>> all.
>
> My benchmark shows that in the current implementation manual deletion of  
> GC memory
> is at least 15 times faster than leaving it up to the GC. (better cache  
> behavior
> of the data unmeasured)

I would need to see what your benchmark is before I'd say it was  
conclusive.

>
>> If you want to gain performance, don't use the GC at all (for
>> example scope classes), or use a custom allocator that is tailored to  
>> your
>> needs.
>
> Agreed. But writing a very well performing custom allocator that scales  
> well with
> the application is a not-exactly-trivial task.

True.  Generally, GC has good enough performance for most applications.   
But again, all of this is somewhat moot since delete isn't exactly going  
away, it's just going away as a keyword.

-Steve


More information about the Digitalmars-d mailing list