April 04

On Thursday, 4 April 2024 at 15:42:24 UTC, ryuukk_ wrote:

>
import core.memory;
import std.stdio;
import std.conv;
import std.datetime.stopwatch;

string[int] stuff;

void main()
{
    for (int i = 0; i < 10_000_000; i++)
        stuff[i] = "hello_" ~ to!(string)(i);

    auto sw = StopWatch(AutoStart.yes);
    auto a = new ubyte[512_000_000];
    writeln(sw.peek.total!"seconds");
}

Question to pro-GC crowd, why does it take 2 seconds to create the array?

I'm not pro or con but that rather looks like a bug, i.e the new'ed array should not be scanned, it's not even initialized so in no way it can contain references to living-in-the-GC-pointers.

(side-node 3 secs here ^^).

April 04

On Thursday, 4 April 2024 at 15:42:24 UTC, ryuukk_ wrote:

>

There is no anti-GC crowd

I will not speak for other people, so i will speak for myself

There's definitely an anti-GC crowd. Most of them don't use D, but they're happy to vandalize discussions about D.

>

I advocate for: GC as a library and core language as pay as you go, so i can use a great language without people making it annoying to use

>

Imagine:

int[] myarray;
create_array(allocator, myarray, length: 16);


int[int] mymap;
create_map(allocator, mymap)


// or fall back to using GC for casual scripting

But once you have to "fall back" to the GC, you've lost anyone that wants to do scripting.

>

No need to pick a clan, be smart, enable people

But in your example, you have picked a clan, those that enjoy dealing with memory management.

>

The absolute best is what Zig is doing by encouraging people to use/request for an allocator

Why would I care about an allocator? These are the specs of the computer that will run my program:

Memory: 125.5 GiB
Processor: 13th Gen Intel® Core™ i9-13900 × 32

If I want to write a program that changes a few lines in a markdown file, for instance, there's no reason to introduce overhead.

>

Question to pro-GC crowd, why does it take 2 seconds to create the array?

Why are you using the GC if that's the code you need to write? Although if I'm writing a script and it's run one time once a day, even that isn't a big deal.

April 04

On Thursday, 4 April 2024 at 16:06:35 UTC, bachmeier wrote:

>

On Thursday, 4 April 2024 at 15:42:24 UTC, ryuukk_ wrote:

>

There is no anti-GC crowd

I will not speak for other people, so i will speak for myself

There's definitely an anti-GC crowd. Most of them don't use D, but they're happy to vandalize discussions about D.

>

I advocate for: GC as a library and core language as pay as you go, so i can use a great language without people making it annoying to use

>

Imagine:

int[] myarray;
create_array(allocator, myarray, length: 16);


int[int] mymap;
create_map(allocator, mymap)


// or fall back to using GC for casual scripting

But once you have to "fall back" to the GC, you've lost anyone that wants to do scripting.

>

No need to pick a clan, be smart, enable people

But in your example, you have picked a clan, those that enjoy dealing with memory management.

>

The absolute best is what Zig is doing by encouraging people to use/request for an allocator

Why would I care about an allocator? These are the specs of the computer that will run my program:

Memory: 125.5 GiB
Processor: 13th Gen Intel® Core™ i9-13900 × 32

If I want to write a program that changes a few lines in a markdown file, for instance, there's no reason to introduce overhead.

>

Question to pro-GC crowd, why does it take 2 seconds to create the array?

Why are you using the GC if that's the code you need to write? Although if I'm writing a script and it's run one time once a day, even that isn't a big deal.

Congratulation, you just describe the reason why nobody wants to take D seriously when it comes to system language with a GC

"Problem? Let's put it under the carpet"

April 04

On Thursday, 4 April 2024 at 16:19:28 UTC, ryuukk_ wrote:

>

Congratulation, you just describe the reason why nobody wants to take D seriously when it comes to system language with a GC

That's a different issue though. D's GC can at times become a problem, and pretty much everyone that says D should embrace the GC also says it should be improved.

In your example, the simple solution is to call GC.disable() before allocating the array, so it's hardly a problem for the cases where this does arise. The real solution is to fix the GC so this doesn't happen. And you can use malloc with reference counting if you don't want to disable the GC when it's needed.

If we move the GC to a library and make it less convenient to use, we've eliminated most scripting usage in return for solving edge cases with a simple solution (probably a bug) like the one you've presented.

April 04

On Thursday, 4 April 2024 at 15:54:30 UTC, bachmeier wrote:

>

What I mean is that a lot of memory I use is allocated either by C libraries or by R's garbage collector. SafeRefCounted takes care of all the details for me so I don't have to think about it.

A great example of the strength of D. Eliminating the GC as the default is premature optimization. When you need to do something else, you can. Tune up your use of the GC or not use it.

April 05

On Thursday, 4 April 2024 at 14:13:52 UTC, Richard (Rikki) Andrew Cattermole wrote:

>

It simply comes down to man power, nobody is willing to do the work.

There just isn't enough of a win here to make anyone motivated to do it.

Not enough of a highly visible tactical win, no. However...

I'm just an occasional intense user of D. However, reading the forums, reading this thread again now specifically, I think it is possible to form a wider conclusion.

There is a massive strategic win to having a fabulous 21st century GC for D, perfectly good for soft-real-time coding with no further ado, like the one used by the author of the article linked at the start of this thread.

We might guess that some people who are trying to find the right tool for the job (their soft-real-time game for example), and who do not like manual memory management because of the additional drag it imposes on the programmer simply did not choose D even though they otherwise would were this ace GC present.

Instead they chose Java or C# or Go (but not C++ or Rust which they detest for the memory management administrative burden it imposes on the programmer and the general complicated nature of coding in such languages).

What we see in the dlang forums related to the above group are such soft-real-time programmers who have labored and successfully overcome or bypassed these difficulties with D's GC in one way or another for their situation.

This is a biased sample! The presence of these successes strongly suggests a larger group who failed to go to D, with the successes the minority who got in. Those that penetrated the armor and those who were deflected. It takes something extra to penetrate the armor, so we might reasonably think that the deflected are in the majority, with the successes being the tip of the iceberg.

D is deterring a class of people that are very much operating in the spirit of D from joining the D community and creating new things that in turn widen positive attitudes to the language out there.

Imagine this: what if D had such an ace GC for the last decade? Perception and use of D would be entirely different to its present state; soft-real-time applications would abound, with a wide community of pro-D game programmers talking in the forums.

Just like ImportC being a game changer, ace GC is a game(!) changer. It's just harder to see this, but it is so.

April 05

On Friday, 5 April 2024 at 16:40:06 UTC, Carl Sturtivant wrote:

>

Imagine this: what if D had such an ace GC for the last decade? Perception and use of D would be entirely different to its present state; soft-real-time applications would abound, with a wide community of pro-D game programmers talking in the forums.

Just like ImportC being a game changer, ace GC is a game(!) changer. It's just harder to see this, but it is so.

A desire to embrace and improve the GC is an important part of the OpenD fork.

>

One of the guiding principles of this fork is to embrace the GC as a successful design rather than to shun and avoid it.

>

Finally, language and library feature discussions are often stopped in their tracks by concerns about @nogc compatibility, without weighing the significant benefits they may bring. "But it needs GC" becomes a feature-killer, and then we're stuck with nothing.

>

I think we're all aligned on the goals of keeping the language easy to use, dispelling myths about the GC (while fixing implementation issues when it isn't just a myth), and not letting good work be blocked by the topic.

April 06

On Friday, 5 April 2024 at 16:40:06 UTC, Carl Sturtivant wrote:

>

There is a massive strategic win to having a fabulous 21st century GC for D, perfectly good for soft-real-time coding with no further ado, like the one used by the author of the article linked at the start of this thread.

This is the point I was trying to make. The strategic win for have a fantastic GC would be immense, and would far outweigh anything we could gain by continuing down the no-GC path. But first I would like to state that I am not advocating that D remove any of the existing no-GC support. Even I use it occasionally!

But I was there when the anti-GC crowd put on a full court press to convince the community that all we needed to do to see massive increase in adoption was make the language more accessible to C/C++ users who need to manually manage memory. As a result, tools like @nogc and -betterC were introduced. When that proved insufficient, the anti-GC crowd started demanding more invasive changes, up to and including removing the GC altogether.

Instead, the world changed around us. Memory Safety is now a national security concern and languages like C/C++ are being slowly replaced in favor of Rust/Go/C#/Java. These languages speak to the most common usages and concerns of the users of programming languages, and those usages/concerns largely do not benefit from no-GC.

Chasing no-GC as far as we did was a mistake that cost us precious time and scarce resources. We need to be mature enough to admit that it was a mistake and correct our course. Given the lessons and direction of the industry over the intervening years, I would strongly argue that now is the time to return our focus to the GC.

>

Imagine this: what if D had such an ace GC for the last decade? Perception and use of D would be entirely different to its present state; soft-real-time applications would abound, with a wide community of pro-D game programmers talking in the forums.

Just like ImportC being a game changer, ace GC is a game(!) changer. It's just harder to see this, but it is so.

Mic. Drop.

April 05
On Sat, Apr 06, 2024 at 12:06:04AM +0000, Adam Wilson via Digitalmars-d wrote:
> On Friday, 5 April 2024 at 16:40:06 UTC, Carl Sturtivant wrote:
> > *There is a massive strategic win to having a fabulous 21st century GC for D, perfectly good for soft-real-time coding with no further ado, like the one used by the author of the article linked at the start of this thread.*
> 
> This is the point I was trying to make. The strategic win for have a fantastic GC would be immense, and would far outweigh anything we could gain by continuing down the no-GC path.

Totally.  If we could introduce write barriers that opens the door to incremental generational GCs, that would be a HUGE step in the long run. Maybe not so much in the short term, but guys, it's been at least a decade. We gotta stop chasing decisions that only benefit the short term. It's time to think about long-term strategy.


[...]
> But I was there when the anti-GC crowd put on a full court press to convince the community that all we needed to do to see massive increase in adoption was make the language more accessible to C/C++ users who need to manually manage memory. As a result, tools like `@nogc` and `-betterC` were introduced. When that proved insufficient, the anti-GC crowd started demanding more invasive changes, up to and including removing the GC altogether.

Walter himself used to say in the old days that it's better to cater to existing, enthusiastic customers who are already here, than to chase would-be customers who claim that if only feature X were implemented, they'd adopt D instantly.  Because once you implement X, said would-be customers would start clamoring for Y instead.  And when you implement Y they would start clamoring for Z.  The truth is that they will never become real customers; X, Y and Z are merely convenient excuses. In the meantime, so much effort is being put towards features that in the long run doesn't draw in the promised rush of new customers (and probably never will), while quality-of-life changes for existing customers are being neglected.


[...]
> Chasing no-GC as far as we did was a mistake that cost us precious time and scarce resources. We need to be mature enough to admit that it was a mistake and correct our course. Given the lessons and direction of the industry over the intervening years, I would strongly argue that now is the time to return our focus to the GC.
[...]

+100.  While there *have* been improvements in our current GC over the past years, we're running against a brick wall in terms of available GC algorithms, because of the pessimistic situation of no write barriers. That closes the door to many of the major advancements in GC algorithms over the past decade or two. It's time we stop sitting on the fence and commit to a GC-centric language that actually has a competitive GC to speak of, one on the level of Java or C#'s incremental generational GCs.


T

-- 
Why did the dinosaur get into a car accident? Because a tyrannosaurus wrecks.
April 06

On Sunday, 31 March 2024 at 14:22:43 UTC, Adam wrote:

>

I think if you like GC, you can try openD, which is pure GC.
As for D, if it's purely GC, why don't others use Rust? Are you prepared to completely abandon for system scope?.