From owner-freebsd-hackers@freebsd.org Tue Jan 1 06:31:43 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 37781148F07A for ; Tue, 1 Jan 2019 06:31:43 +0000 (UTC) (envelope-from brian@aceshardware.com) Received: from mail.aceshardware.com (mail.aceshardware.com [52.52.37.31]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DE5318331D for ; Tue, 1 Jan 2019 06:31:41 +0000 (UTC) (envelope-from brian@aceshardware.com) Received: from [10.0.0.102] (unknown [71.145.208.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.aceshardware.com (Postfix) with ESMTPSA id E229F20130F; Tue, 1 Jan 2019 06:31:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aceshardware.com; s=dkim; t=1546324299; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vFciFHFEVwdxuVAE5dnDrhMhmzFOw5omiLWaWA7cJqQ=; b=V6yHyX3DoL8Cj6BAtnuuPSTmNFdQ785fOY7tjUcmXSHf2YD+waS3+Txtm6okzQxt7R5MyR QaWF8kMNjdjQC6cs5euiBw1hGfB9cnOnloWz8TsmZvHLrf7mWit/SOsGx8kpNzOCg82ZfT qcDaH+o8vTFdAC9uLAbrGF0GyfroV1/KDcW+NFzqE85hHra9gVI3J3F0QWBvIROKXZub6e tn0JAlK897tzhVDsp/iFKY7iVdnjR3No2aorB/NmClG4wHDGpqBuShIrdLEqvsLvA0YeD2 qw96wLE3GomB2MeThcpdD9k2kRcL6PfFRBu5j29XdeLPmCL03nhHbbMsoZ24dA== Subject: Re: Speculative: Rust for base system components To: Garance A Drosehn Cc: freebsd-hackers@freebsd.org References: <7d7bc47d-04cf-2f9b-00a3-e3d9d92b3623@aceshardware.com> <72922F2C-9D27-47AA-BB1C-2DA8589CF008@rpi.edu> From: Brian Neal Message-ID: <92bd5362-d898-aa12-8f3d-9fbe23f38e0c@aceshardware.com> Date: Mon, 31 Dec 2018 23:32:09 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <72922F2C-9D27-47AA-BB1C-2DA8589CF008@rpi.edu> Content-Language: en-US X-Rspamd-Queue-Id: DE5318331D X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=aceshardware.com header.s=dkim header.b=V6yHyX3D; dmarc=pass (policy=none) header.from=aceshardware.com X-Spamd-Result: default: False [-3.05 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[aceshardware.com:s=dkim]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_SPAM_SHORT(0.04)[0.044,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[aceshardware.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[aceshardware.com,none]; MX_GOOD(-0.01)[cached: mail.aceshardware.com]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+]; IP_SCORE(-0.28)[ipnet: 52.52.0.0/15(-0.11), asn: 16509(-1.22), country: US(-0.08)]; ASN(0.00)[asn:16509, ipnet:52.52.0.0/15, country:US]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Tue, 01 Jan 2019 06:31:43 -0000 It was a debug build with no optimization for either compiler. But we can easily run a variety of settings for comparison: Compiler              Flags                 Inst. Count Build Time ====================================================================== clang 7.0.0           none                           33 296ms                       -O3                            23 341ms rustc 1.31.0          none                          110 606ms                       -C opt-level=3                 67 643ms gcc 8.2               none                           37 211ms                       -O2                            24 249ms                       -O3                          119* 206ms * With -O3, gcc unrolled and vectorized the loop. The other compilers did not emit vectorized code at any of the standard optimization levels. So, essentially, double the build time and ~3 times the code for the same logic. On 12/31/2018 7:23 PM, Garance A Drosehn wrote: > > On 31 Dec 2018, at 23:04, Brian Neal wrote: > > This is a good read on some of the pitfalls of Rust: > > https://hackernoon.com/why-im-dropping-rust-fd1c32986c88 > > In terms of performance, take a look at Rust on godbolt...a quick > test I just ran with a trivial program that sums up a sequence of > odd numbers is 29 instructions in C on clang 7.0 and a whopping > 137 (!!!) on rustc 1.31.0! > > Crazy... > > Did you compile your program as a "release build", or just as a > standard (quick) build? > > -- > Garance Alistair Drosehn = drosih@rpi.edu > Senior Systems Programmer or gad@FreeBSD.org > Rensselaer Polytechnic Institute; Troy, NY; USA >