Speculative: Rust for base system components
Brian Neal
brian at aceshardware.com
Tue Jan 1 06:31:43 UTC 2019
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 at rpi.edu
> Senior Systems Programmer or gad at FreeBSD.org
> Rensselaer Polytechnic Institute; Troy, NY; USA
>
More information about the freebsd-hackers
mailing list