Speculative: Rust for base system components
Brian Neal
brian at aceshardware.com
Sun Jan 6 17:50:39 UTC 2019
Of course. But I'm counting like for like. So labels are counted for
all languages. And I definitely don't rely on LTO when comparing the
efficacy of compiler, especially since the linker can spend lots of time
eliminating dead-code (usually single-threaded), which means longer
build times.
On 1/6/2019 9:17 AM, Alan Somers wrote:
> Those 21 lines aren't 21 instructions; you're counting labels. Also,
> the first three instructions aren't actually part of the function.
> They're dead code, and should be eliminate by LTO. However, Rust
> doesn't do LTO when compiling libraries; only when linking
> executables. The unwrap logic, etc is also not part of the function.
> So in this example, Rust produces only a few more instructions than C.
> Also, FYI the Rust expression "0..num" is exclusive on the right.
> It's equivalent to C's "for (int i = 0; i < num; i++)", though that
> doesn't change the instruction count.
>
> -Alan
More information about the freebsd-hackers
mailing list