From owner-freebsd-hackers@freebsd.org Mon Dec 31 22:44:32 2018 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7E1B8141EA11 for ; Mon, 31 Dec 2018 22:44:32 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 231DB888A5; Mon, 31 Dec 2018 22:44:32 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from [192.168.2.1] (unknown [IPv6:2620:0:2820:2:795b:61b7:2dc4:6168]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gad/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 0169B1C3AC; Mon, 31 Dec 2018 22:44:31 +0000 (UTC) (envelope-from gad@FreeBSD.org) From: "Garance A Drosehn" To: "Alan Somers" Cc: freebsd-hackers@freebsd.org Subject: Re: Speculative: Rust for base system components Date: Mon, 31 Dec 2018 17:44:29 -0500 X-Mailer: MailMate (1.12.3r5579) Message-ID: <5B476178-4D09-486F-AC58-47CB04965335@FreeBSD.org> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; format=flowed Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 231DB888A5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.98 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.98)[-0.979,0]; NEURAL_HAM_LONG(-1.00)[-0.998,0] X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Dec 2018 22:44:32 -0000 On 31 Dec 2018, at 11:52, Alan Somers wrote: > On Mon, Dec 31, 2018 at 12:17 AM Conrad Meyer 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 = > 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