From owner-freebsd-hackers@freebsd.org Wed Jan 2 11:06:22 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 B5D2C143F08B for ; Wed, 2 Jan 2019 11:06:22 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: from mail-ot1-x32f.google.com (mail-ot1-x32f.google.com [IPv6:2607:f8b0:4864:20::32f]) (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 563248682A for ; Wed, 2 Jan 2019 11:06:21 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: by mail-ot1-x32f.google.com with SMTP id w25so26354836otm.13 for ; Wed, 02 Jan 2019 03:06:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=PmfehenVJMKBU2SjtOEhs7tOrwvN2KC/aMrbXurrucI=; b=LqIyo4e9EEyj7Vm+qUvQ/7kMofgSzIu2Ed5VqxBw9wcjQ4sgL4IvZAikvzuur/F5+y NG4MT+ZOV2147hde0MSMQ0SGbFPFLgVdJZ1gevcYVTOP+6/z/Q8Zg8WFXPVBobUstWSI +8y90uI82eRsKhCP+UuOZHUdrVbabLDbr3e+tq4/rcY4R0mrv6Fb+5nWjnngk/zjLWo8 kXQVvUxk4lCbj+txP9uJP+wb8MvhfInGcda4+DjoayjygVbpLTCh6n3eUenBRFgW0dek NTe1JhwehYkjxNz5nfA+UwqpqXi3XmWsTsi+quQnmS2Dj6k19njCW+O/OLoAS44ghEd/ Xmag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=PmfehenVJMKBU2SjtOEhs7tOrwvN2KC/aMrbXurrucI=; b=GwEX4dfK9y8zSfMdiXH1bczdg0w3Ek9QQceGRqWv5XLgul5drBK1za8vyXSAM2S+I3 dWsX8dr2zf5ny0QXdQkgYeVlfA7rqdDMB0INRr539gy91bqT0USX/Vj4KHGqSDtyybSK CIx3Cg7GPbl02tPW37TmUMRgvFikL/r3jykOe+X4zScP7uT2nZX30pwNuW5BFeJ1JChu EjX8zZeboBwGwqYwxWz4eyqrWC0DzTHIrUq9H9JBX2TtoD0YO3jo6vDo5IC1c0CCaHeM Lcnj8vUBnEENQss8PU1FQ7jwdDblP9a/W1SusoB6xbSCkQRCXpwqRW6bFT1Z4ThY34Vs Sdnw== X-Gm-Message-State: AJcUukchmPTi4zk1BqXOPREzgFcPOI5CHysOYkl9Yw1rMrykP7ywZ31L yAPOqHaOl9xcRmFDuqVfj/v7WxDQ X-Google-Smtp-Source: ALg8bN6jbtPCD6lm26mCqzZSd6uM1COzV0fm2s0wKXvrK8I5HxmhmIx/ag2ZGBPVDdCIoZjjSUa9wA== X-Received: by 2002:a9d:6353:: with SMTP id y19mr30627046otk.336.1546427179948; Wed, 02 Jan 2019 03:06:19 -0800 (PST) Received: from [192.168.1.33] ([81.174.250.12]) by smtp.gmail.com with ESMTPSA id m131sm23065032oia.6.2019.01.02.03.06.18 for (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 02 Jan 2019 03:06:19 -0800 (PST) Subject: Re: Speculative: Rust for base system components To: freebsd-hackers@freebsd.org References: <20190101045638.D280E1F56@spqr.komquats.com> <4ea0612bbad08e61a15d495459b2bede@rpi.edu> From: Johannes Lundberg Message-ID: <804bd7ee-d9c3-08ba-031f-df0348860d35@gmail.com> Date: Wed, 2 Jan 2019 11:06:16 +0000 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Rspamd-Queue-Id: 563248682A X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=LqIyo4e9; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of johalun0@gmail.com designates 2607:f8b0:4864:20::32f as permitted sender) smtp.mailfrom=johalun0@gmail.com X-Spamd-Result: default: False [-6.48 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; MX_GOOD(-0.01)[cached: alt3.gmail-smtp-in.l.google.com]; NEURAL_HAM_SHORT(-0.91)[-0.914,0]; FROM_EQ_ENVFROM(0.00)[]; RCVD_TLS_LAST(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; IP_SCORE(-2.56)[ip: (-9.02), ipnet: 2607:f8b0::/32(-2.08), asn: 15169(-1.61), country: US(-0.08)]; RCVD_IN_DNSWL_NONE(0.00)[f.2.3.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.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: Wed, 02 Jan 2019 11:06:22 -0000 On 1/2/19 12:35 AM, Conrad Meyer wrote: > 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 — 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. Hi Rust by default statically link everything in executable binaries. This is comparable to statically link in libc and all other dependencies in your C program. You can have Rust programs link against shared rust libraries (std, etc) and get the size down to basically same as C. If Rust is used in base and everything is built at the same time, with same version compiler, it would make sense to link dynamically I think. Switching topic a bit. Just wanted to also add my contribution, a simple sysctl Rust library https://github.com/johalun/sysctl-rs . Cheers > > 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 > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"