Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Sep 2024 07:40:55 -0400
From:      Aryeh Friedman <aryeh.friedman@gmail.com>
To:        David Chisnall <theraven@freebsd.org>
Cc:        Joe Schaefer <joesuf4@gmail.com>, Pat Maddox <pat@patmaddox.com>,  Alan Somers <asomers@freebsd.org>, Chris <bsd-lists@bsdforge.com>,  Warner Losh <imp@bsdimp.com>, FreeBSD Hackers <freebsd-hackers@freebsd.org>
Subject:   Re: The Case for Rust (in any system)
Message-ID:  <CAGBxaX=N_%2BvtF1HpM9OqUN-6O3AFTPj65UA04d8h74D=Y6Kf2g@mail.gmail.com>
In-Reply-To: <2D0F93DC-36DA-4FB9-BFD2-D7678EC03CD7@FreeBSD.org>
References:  <CAOzHqcJ0rOR4CoL84WgZQNcgY2G9vuiHccE4XT_otJ2R51KJ3Q@mail.gmail.com> <2EE309BF-CE1D-48AD-9C53-D4C87998B4A0@freebsd.org> <CAOzHqcJs2Ls9rG-X9%2Bjsc=Z2XHvh_eo=5jyFSaTDc6kUMK8vPg@mail.gmail.com> <2D0F93DC-36DA-4FB9-BFD2-D7678EC03CD7@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Sep 13, 2024 at 4:54=E2=80=AFAM David Chisnall <theraven@freebsd.or=
g> wrote:
>
> On 13 Sep 2024, at 08:59, Joe Schaefer <joesuf4@gmail.com> wrote:
>
>
> That=E2=80=98s  because you are a dork.
>
>
> In case you were wondering, that was the point when you lost all credibil=
ity in this thread.
>
> The point isn=E2=80=99t that calloc calls are faster than vector allocati=
ons.   The point is that by changing the way you deal with arrays (as objec=
ts that manage their own size, versus managing the sizes using up front pre=
allocations and dealing with their growth yourself), we can exchange functi=
on calls for pointer dereferences.
>
>
> And that=E2=80=99s precisely the change you get by calling .reserve with =
the expected size.  And the speedup tends to be exactly what you claimed yo=
u got.

Speaking both as a freelance software engineer who works in
soft-realtime and soft-IoT (the EMR for a medical lab that does remote
cardiac monitoring) and as hopefully a PhD candidate in theoretical CS
(whose research revolves around the minimum number of gates needed for
Turing completeness) I can make few observations here that make clear
that while having good intentions Rust completely misses the mark for
being a true systems programming language:

1. Fixed allocations are *ALWAYS* safer and more predictable then
dynamic ones (dynamic ones are undecidable in there nature and
effects).

2. Combining fixed allocation with dynamic (under the hood and
unrequested) allocation is a very bad idea.

3. It is possible to do all the above safely with arrays and not
pointers IF the arrays are static but not dynamic.

This implies that if and when you grow/shrink the physical array you
need to have really tight control on timing and Rust does not provide
that by putting it all under the hood.


--=20
Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAGBxaX=N_%2BvtF1HpM9OqUN-6O3AFTPj65UA04d8h74D=Y6Kf2g>