Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Dec 2018 17:44:29 -0500
From:      "Garance A Drosehn" <gad@FreeBSD.org>
To:        "Alan Somers" <asomers@freebsd.org>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Speculative: Rust for base system components
Message-ID:  <5B476178-4D09-486F-AC58-47CB04965335@FreeBSD.org>
In-Reply-To: <CAOtMX2gO5yMxLpZYxmfG3DFhRnZna-mQBOGXe=OJOzP4QfpBmg@mail.gmail.com>
References:  <ca76e5f7-6e59-bd67-144a-90ad66f0252e@metricspace.net> <CAG6CVpV0kxupmkhHiYBT05Yfst6uNtbUyYUzG95Zwcbk9F3K0Q@mail.gmail.com> <CAOtMX2gO5yMxLpZYxmfG3DFhRnZna-mQBOGXe=OJOzP4QfpBmg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 31 Dec 2018, at 11:52, Alan Somers wrote:

> On Mon, Dec 31, 2018 at 12:17 AM Conrad Meyer <cem@freebsd.org> wrote:
>>
>> Rust has many of the exact same problems C++ has.  Sure, it avoids
>> a few classes of issue.  But it doesn't fix the classic C++ problems
>> of extremely slow build times (if you think C++ is bad, Rust is
>> worse) and having a kitchen sink of language features that make Rust
>> and C++ code difficult to grok.
>
> Do you have any data to support the claim of slow build times?
> I know it's very hard to do an apples-to-apples comparison of build
> times between different languages, but I would be interested to see
> somebody try.

I know that it takes a very long time to build rust (the compiler
itself) on my mac, and FreeBSD's buildworld always starts out by
building the compilers that it needs.  So adding rust to the base
system is going to cause an immediate and noticeable increase in
the time used by buildworld.  (now maybe that means we should
come up with some different ideas for handling the compilers in
buildworld, but I digress...).


On 31 Dec 2018, at 8:18, Jan Knepper wrote:
>
> What about D?
> www.dlang.org
>
> ManiaC++
> Jan Knepper

For what it's worth, I'm also interested in D-lang, and I know that
the developers of D are paying attention to Rust, and trying to
figure out what ideas from Rust could be added to D-lang without
making a mess of things.  And it's nice that there are three
separate implementations of D-lang.  ... but no, I would not
include D-lang into the base system just yet.

But getting back to Rust:

On 31 Dec 2018, at 9:21, Igor Mozolevsky wrote:
>
> On Mon, 31 Dec 2018 at 05:42, Eric McCorkle <eric@metricspace.net> =

> wrote:
>>
>> Before I begin, I want to be clear that everything here is in the =

>> realm
>> of speculative, long-term discussion.  My goal is to start a
>> conversation, not to propose anything concrete right now.
>
>
> Does the generated code size increase or decrease and does the
> data-path get longer or shorter with switch from C to Rust with
> all the "great features" of Rust?  Are there any metrics for
> these?  If a CPU cache gets trashed repeatedly or data takes
> massive detours that would be a significant downside, wouldn't it?

I've been somewhat interested in Rust for awhile, although I haven't
had the time to do much of anything with it.  Part of the answer to
your questions will depend on how good the programmers are.  One
advantage the BSD projects have by sticking with C is that we have
spent a lot of time becoming good at that one language.  We have a
lot of developers who can look at an update to C code, and quickly
notice some of the most-common problems which come up when writing C.

But there is evidence that once you have decent experience with Rust,
then you can write code which is as fast or even faster than what you
would write in C.

Lately Bryan Cantrill has been taking some deep dives into using Rust,
and it's interesting to listen to his experiences.  In particular his
summer-project for rewriting one of his own programs (called =

"Statemaps")
into Rust, which went much better than he expected it to.  Here are a
few of his recent presentations where he's talked about Rust:

https://www.youtube.com/watch?v=3DaWbGPMxs0AM - Statemaps in Rust
https://www.youtube.com/watch?v=3D2wZ1pCpJUIM - Rust and other interestin=
g =

things
https://www.youtube.com/watch?v=3DLjFM8vw3pbU - The Summer of Rust
https://www.slideshare.net/bcantrill/is-it-time-to-rewrite-the-operating-=
system-in-rust
    -- Title: "Is it time to rewrite the operating system in Rust?"
    --        "A talk given at QConSF in 2018. Video to come"
    -- Spoiler: The answer is "No" for *rewriting* an operating
       system, but it could be a good choice for writing new
       modules for an existing kernel.

I think he's done a few other presentations wrt Rust, but I can't
seem to find them right now.  Maybe they're on Vimeo.

I expect Rust could be very interesting for systems-programming in
the future, but I also think we (FreeBSD developers) would need to
have more experience with it before pulling it into the base system.

-- =

Garance Alistair Drosehn                =3D     drosih@rpi.edu
Senior Systems Programmer               or   gad@FreeBSD.org
Rensselaer Polytechnic Institute;             Troy, NY;  USA



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5B476178-4D09-486F-AC58-47CB04965335>