Nobady is going to complain about that...

bauss jj_1337 at live.dk
Sat Apr 25 16:05:25 UTC 2020


On Thursday, 23 April 2020 at 19:48:33 UTC, solidstate1991 wrote:
> * GC allocation with `new` has little to no performance penalty 
> compared to using `malloc` or something like that, only the 
> former is less of a hassle and have less of a chance for 
> something to go wrong.

The problems with GC and performance are usually not in 
allocations, in fact they can sometimes do faster allocations 
because they don't need to always ask the system for a new memory 
block. Not sure how the GC in D actually works entirely but I can 
imagine that it pre-allocates __some__ memory blocks.

The problem with a GC is when memory needs to be freed. Hence why 
you will probably __never__ notice any bottlenecks in allocating.

I'm not against nor for GC, in fact using a GC has its pros and 
cons, just like not using one has both.

I like that D lets you do both.


More information about the Digitalmars-d mailing list