4 ms·
A few days ago I posted a comment with my problems with C. Can you use Rust as a better C/cross-platform-assembly? does it have native support for - vectoriza
by optforfon 10y ago
A few days ago I posted a comment with my problems with C. Can you use Rust as a better C/cross-platform-assembly?
does it have native support for
- vectorization/SIMD
- hinting at likely branches
- prefetching memory
- forcing or blocking inlining
and all the magic in gcc C extensions
- alkonaut 10y agoManual SIMD intrinsics is getting there, not sure how far it has come by now: https://github.com/rust-lang/rust/pull/27169 https://github.com/rust-lang/rust/pull/27169 I'm sure LLVM does a fair bit of vectorization under the hood too of course, but not sure whether better knowledge of aliasing lets it do more or whether less undefined behavior sloppyness in Rust lets it do less of it than for C++. Branch hint intrinsic: an accepted RFC but not yet implemented https://github.com/rust-lang/rust/issues/26179 https://github.com/rust-lang/rust/issues/26179 Prefetch intrinsic: Looks like a rejected rfc https://github.com/rust-lang/rfcs/pull/125 https://github.com/rust-lang/rfcs/pull/125 Inlining: As far as I understand the attributes are #[inline(always)] and #[inline(never)] respectively.
- optforfon 10y agoThanks for the links! This info is kinda hard to find if you're not in the loop. But it looks like low level optimization is a low priority for the Rust project at the moment. (prefetch is rejected b/c of insufficient testing and branch hinting might get hampered b/c Rust developers aren't trusted to use them correctly) Maybe I'll revisit it in the future! Appreciate the help =)