You don't like GC? Do you?

Nicholas Wilson iamthewilsonator at hotmail.com
Fri Oct 12 23:32:34 UTC 2018


On Friday, 12 October 2018 at 20:12:26 UTC, Stanislav Blinov 
wrote:
> On Friday, 12 October 2018 at 19:55:02 UTC, Nicholas Wilson 
> wrote:
>
>> Freeing your mind and the codebase of having to deal with 
>> memory leaves it in an easier place to deal with the less 
>> common higher impact leaks: file descriptors, sockets, 
>> database handles ect. (this is like chopping down the forest 
>> so you can see the trees you care about ;) ).
>
> That's done first and foremost by stripping out unnecessary 
> allocations, not by writing "new" every other line and closing 
> your eyes.

If you need perf in your _scripts_, a use LDC and b) pass -O3 
which among many other improvements over baseline will promote 
unnecessary garbage collection to the stack.

> I mean come on, it's 2018. We're writing code for multi-core 
> and multi-processor systems with complex memory interaction.

We might be sometimes. I suspect that is less likely for a script 
to fall in that category.

> Precisely where in memory your data is, how it got there and 
> how it's laid out should be bread and butter of any D 
> programmer. It's true that it isn't critical for one-off 
> scripts, but so is deallocation.
>
> Saying stuff like "do more with GC" is just outright harmful.

That is certainly not an unqualified truth. Yes one shouldn't 
`new` stuff just for fun, but speed of executable is often not 
what one is trying to optimise when writing code, e.g. when 
writing a script one is probably trying to minimise 
development/debugging time.

> Kids are reading, for crying out loud.

Oi, you think thats bad? Try reading what some of the other 
Aussies post, *cough* e.g. a frustrated Manu *cough*



More information about the Digitalmars-d mailing list