BLAKE3-team / BLAKE3

the official Rust and C implementations of the BLAKE3 cryptographic hash function
Apache License 2.0
4.97k stars 337 forks source link

Why not inline asm in Rust, but inline it in C and then FFI? #308

Open stackinspector opened 1 year ago

stackinspector commented 1 year ago

This would create unnecessary FFI and have to call C compiler when Rust version compiles. Rust nowadays have no problem calling the instruction set manually and inlining asm, but I'm not sure if we can inline asm in external files.

mert-kurttutan commented 2 months ago

I am also curious about this choice (as well as the absence of rust_neon implementation).

Also, you can include include assembly files using !include_str and raw option.

The inline_assembly is more portable than using assembly file since you just need to follow rules of inline_asm macro (in comparison to all the ABI rules). It might be the timing since inline_assembly was introduce around 2019.

I wonder if there is any other reason for this decision.