John Carmack applauds D's pure attribute
s.d.hammett at gmail.com
Sat Feb 25 16:01:59 PST 2012
On 25/02/2012 22:55, Walter Bright wrote:
> On 2/25/2012 2:08 PM, Paulo Pinto wrote:
>> Most standard compiler malloc()/free() implementations are actually
>> slower than
>> most advanced GC algorithms.
> Most straight up GC vs malloc/free benchmarks miss something crucial. A
> GC allows one to do substantially *fewer* allocations. It's a lot faster
> to not allocate than to allocate.
> Consider C strings. You need to keep track of ownership of it. That
> often means creating extra copies, rather than sharing a single copy.
> Enter C++'s shared_ptr. But that works by, for each object, allocating a
> *second* chunk of memory to hold the reference count. Right off the bat,
> you've got twice as many allocations & frees with shared_ptr than a GC
> would have.
so you don't have to have twice as many allocations.
My enormous talent is exceeded only by my outrageous laziness.
More information about the Digitalmars-d