[Info-vax] Rust as a HS language, was: Re: Quiet?

Arne Vajhøj arne at vajhoej.dk
Wed Apr 6 09:09:43 EDT 2022


On 4/5/2022 9:30 PM, Dan Cross wrote:
> In article <624ce3dd$0$694$14726298 at news.sunsite.dk>,
> Arne Vajhøj  <arne at vajhoej.dk> wrote:
>> On 4/5/2022 8:41 PM, Dan Cross wrote:
>>> In article <624cd4e1$0$701$14726298 at news.sunsite.dk>,
>>> Arne Vajhøj  <arne at vajhoej.dk> wrote:
>>>> Rust has a unique approach to memory handling based on
>>>> ownership (idea borrowed from modern C++ best practice
>>>> not C++ language) that avoids memory leaks without GC - as
>>>> a low level language that may be used in real time
>>>> context, then the standard solution to avoid memory
>>>> leaks in high level languages GC could be problematic.
>>>
>>> Yup.  You get something _very_ close to managed memory without
>>> the overhead of GC.  Note that sometimes GC can be surprisingly
>>> helpful in high-overhead situations (think tight loops where,
>>> thanks to GC, you don't have to check ref counts or pointer
>>> validity...), but generally you get much of that in Rust without
>>> the additional overhead.
>>
>> Despite what many think then the problem with GC is not
>> overhead. Often GC is as efficient or even more efficient
>> than manual deallocation.
> 
> Eh?  It's commonly accepted that you're going to give up some
> percentage of your capacity for GC overhead. 

No it is not.

With generational garbage collectors it is very fast to GC
short lived objects.

>                                         The Go runtime
> reserves 25% of CPU time for GC, for instance.

I don't know Go that well.

But that is absolutely horrible.

It should be less than 5%.

Go does not use generational garbage collection - it tries
on escape analysis to put stuff on stack instead of heap. But
if the 25% is correct then they made the wrong decision.

>> The problem with GC is the poor real time characteristics.
>> It tend to give small pauses at non-deterministic point.
> 
> That's the old style GC.  Go's concurrent GC mostly avoids that
> unless under severe memory pressure.

No.

Go GC use STW. They have managed to reduce the time but it is
still a STW.

The only GC I am aware of that does not do STW is Azul Zing.

Arne



More information about the Info-vax mailing list