From owner-freebsd-hackers@freebsd.org Wed Jan 2 00:36:09 2019 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 9F717142F601 for ; Wed, 2 Jan 2019 00:36:09 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-it1-f182.google.com (mail-it1-f182.google.com [209.85.166.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8DD26B3BD for ; Wed, 2 Jan 2019 00:36:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-it1-f182.google.com with SMTP id h65so37147473ith.3 for ; Tue, 01 Jan 2019 16:36:08 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=UHmCw3EmyDmySVTv+Pfdon9xFFb0opGe2SC7jutiNp8=; b=kWphM1V/SmNjHgD5wvomyAWlGKFBLaCjlwDzqEzV+1xYQ8abMBDyIylD82dIdBOnIv aF/VMnatE+46kTJUkG29TeH5QNLFW+4tsLkSCuFW0nZkGj35h/hkt9G2haIKBx/g+7pu o6bq4LTlP+4N+ffqfs++p1L45TqEKiOa0P3trsjXGEds9Cb0Z+Tj6XYIucfHpywL++XV lp39wF0dQi3b1YFSt+fqAgsX0mygZYwQTJ1ojmQUmpGETO02aAZytuGPpOojmp8Vzezb uaxzIUA7N9SnE4eHqGFyoeCYUH+yz1vMc7HX9L8P9YJ8ZJGJ/wNe5G4JKsK9i0aYfNTI B+Jw== X-Gm-Message-State: AA+aEWa7FK/eFTAK491tFwaKDQ4N/ypMWsLt4mF4tVEkTSVyHJRodyQD 09bq5kbkrOe4Ju7GNP67w34+qDj+ X-Google-Smtp-Source: AFSGD/WgyDWHcqQxTU3vaEZYGimIGk33J0TLUKfSSrpttzY5Ed8rCPQlaUQJ5TPEDXdn4UMsLsmLqw== X-Received: by 2002:a02:a15e:: with SMTP id m30mr28575845jah.143.1546389362053; Tue, 01 Jan 2019 16:36:02 -0800 (PST) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com. [209.85.166.41]) by smtp.gmail.com with ESMTPSA id m10sm9545112ioq.25.2019.01.01.16.36.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Jan 2019 16:36:01 -0800 (PST) Received: by mail-io1-f41.google.com with SMTP id s22so23468961ioc.8 for ; Tue, 01 Jan 2019 16:36:01 -0800 (PST) X-Received: by 2002:a5e:8d04:: with SMTP id m4mr24566595ioj.233.1546389361000; Tue, 01 Jan 2019 16:36:01 -0800 (PST) MIME-Version: 1.0 References: <20190101045638.D280E1F56@spqr.komquats.com> <4ea0612bbad08e61a15d495459b2bede@rpi.edu> In-Reply-To: <4ea0612bbad08e61a15d495459b2bede@rpi.edu> Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 1 Jan 2019 16:35:49 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Speculative: Rust for base system components To: drosih Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: A8DD26B3BD X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of csecem@gmail.com designates 209.85.166.182 as permitted sender) smtp.mailfrom=csecem@gmail.com X-Spamd-Result: default: False [-5.91 / 15.00]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; HAS_REPLYTO(0.00)[cem@freebsd.org]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; REPLYTO_ADDR_EQ_FROM(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.98)[-0.985,0]; FORGED_SENDER(0.30)[cem@freebsd.org,csecem@gmail.com]; IP_SCORE(-2.91)[ip: (-9.10), ipnet: 209.85.128.0/17(-3.77), asn: 15169(-1.60), country: US(-0.08)]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_NEQ_ENVFROM(0.00)[cem@freebsd.org,csecem@gmail.com]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[182.166.85.209.list.dnswl.org : 127.0.5.0]; RCVD_TLS_LAST(0.00)[] 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: Wed, 02 Jan 2019 00:36:09 -0000 Hi Garance, On Tue, Jan 1, 2019 at 3:18 PM drosih wrote: > Brian's simple experiment is a simple experiment. It's interesting, > but hardly the definitive word in evaluating a language. Sure, that's fair enough. On the other hand, it matches every other report of the compiler and language I've heard, even from advocates of the language. Compiler performance was on the Rust roadmap for 2017 (incremental rebuilds added during 2017) and 2018: https://blog.rust-lang.org/2017/02/06/roadmap.html https://blog.rust-lang.org/2018/03/12/roadmap.html In particular I think the Rust 2018 community survey (URL below) is informative. Scroll to the figure just above "Many non-users responded that they did want to learn Rust, but there were factors that slowed them down." Leading reasons for people who had used Rust but no longer did were: (1) Rust is too intimidating, too hard to learn, or too complicated; (3) Rust doesn't solve a problem for me; and (6) Switching to Rust would slow me down too much. One of the top 10 free-form comments for November 2018 is "improve compile times." It's still a problem. https://blog.rust-lang.org/2018/11/27/Rust-survey-2018.html > I thought the 'ripgrep' program seemed like an interesting one > to look at. Compare how fast it works to how fast our grep works. It's not a great comparison; our grep (either GNU grep 2.5.1 or BSDgrep) is just not very good and must conform to POSIX. 'ag' (pkg install the_silver_searcher) is a more interesting comparison, with similar ability to exclude files automatically. Both are source-code focused; by default, both .gitignore and similar files to exclude files and directories. Both share similar goals, probably inspired by 'ack' (which is slower than both): high real-world performance, threaded search, and fast, non-PCRE regular expressions by default. On the other hand, grep(1) must maintain POSIX compatibility, which makes for significantly slower defaults in many searches. This limits the impact of improving the performance of the internals on real-world, default-behavior search =E2=80=94 because excluding files is a huge boon for ag/rg. In my experience, ripgrep is much faster than our grep, but pretty similar to 'ag'. Both have a comparable feature set; if anything, ag has more features IME. The binary sizes are interesting: -r-xr-xr-x 3 root wheel 113640 Nov 4 15:47 /usr/bin/grep* -r-xr-xr-x 1 root wheel 89104 Oct 28 14:24 /usr/local/bin/ag* -rwxr-xr-x 1 root wheel 4284416 Oct 29 05:12 /usr/local/bin/rg* All are dynamically linked and stripped amd64 binaries. Ripgrep (Rust) is 48x the binary size of ag and 37x that of grep(1). Like grep(1), 'ag' is written in C. Of that 4 MB binary, 2805414 bytes of ripgrep are ".text". Other major contributors are .rodata, .eh_frame and .rela.dyn at 540kB, 300kB, and 240kB respectively. Of the 89 kB ag binary, 37 kB is ".text", 14kB is ".rodata," and 13kB is ".data". I think this difference is illustrative and reasonably representative. Best, Conrad