Frameworks and libraries

bachmeier no at spam.net
Thu Sep 14 19:40:24 UTC 2023


On Thursday, 14 September 2023 at 17:32:19 UTC, H. S. Teoh wrote:
> On Thu, Sep 14, 2023 at 04:28:24PM +0000, Adam D Ruppe via 
> Digitalmars-d wrote:
>> On Thursday, 14 September 2023 at 15:40:30 UTC, user548215 
>> wrote:
> [...]
>> > based on the discussions I've read about the Garbage 
>> > Collector in the D programming language, I've decided to 
>> > abstain from using that feature.
>> 
>> This is a mistaken decision.
>
> Yeah, in 90% of the use cases, the GC actually helps much more 
> than it hurts.  Two of the biggest advantages:

I'd add another disadvantage of the GC that probably won't be 
there: performance.

I don't find that avoiding the GC speeds up my code that often. 
Sometimes it helps to disable the GC if I'm reading a very large 
number of elements into an AA of AA's.

What consistently improves performance is avoiding allocation of 
large blocks of memory - and it's easier to do that correctly 
when you're using the GC. If you don't allocate, the GC will not 
run, problem solved. Completely avoiding the GC is a sensible if 
you're writing a game, but at best not that helpful if you just 
want your program to run faster.



More information about the Digitalmars-d mailing list