4 ms·
What does this have to do with the operating system? There are no syscalls in the code measured here.
by eloff 4y ago
What does this have to do with the operating system? There are no syscalls in the code measured here.
- m00dy 4y agoBecause rust is a compiled language and therefore it means you compile your code to a certain architecture. Who told you about syscalls ? There are systems not using syscalls
- eloff 4y agoThere are no syscalls or equivalent operating system calls in the code paths measured. The architecture is also independent of the operating system, with exceptions in some languages for the calling convention (not in rust, afaik, or at least rust makes no guarantees there.)
- CryZe 4y agoHowever, in practice Rust's calling convention does actually depend on the operating system. So on Linux Rust will make use of the stack red zone, while on Windows it doesn't. (Also some codegen in LLVM depends on the operating system)
- pclmulqdq 4y agoThe dependency is on the ABI, which can be OS-dependent. Also, it is a depressingly manual optimization to do: compilers don't know when it is safe to change a reference to a copy (for example) without an analysis of future code that they don't do.
- littlestymaar 4y agoWith Rust ownership guarantees, the compiler has the info it needs to perform this kind of optimizations.
- pclmulqdq 4y agoC and C++ are also set up such that the compiler can do that optimization, they just don't. I'm pretty sure the Rust compiler is in the same boat - has the information, but doesn't do the optimization.
- masklinn 4y agoThe "C ABI" is really "the platform ABI", because most OS are interacted with through libc (or equivalent). Though that should not apply to Rust at all, as it does not pledge to follow the C ABI internally (aka `extern "Rust"`).