Live data from Hacker News

Why is calling my asm function from Rust slower than calling it from C?

ohadravid.github.io

41–43 of 43 posts

Re: Why is calling my asm function from Rust slower than calling it from C?

#41
post #40

Title reminded me of something completely unrelated: FFI overhead is not to be neglected sometimes. I've seen cases where replacing a python or js lib with an in isolation much faster native Rust or C lib with bindings had the end result being a decrease in real-world performance due to it being in a hot path or loop and the overhead being more significant than the savings were. There is no substitute for real-world…

(Author here) yes! I also wrote about this (specifically in Python->Rust FFI) in another article:

https://ohadravid.github.io/posts/2023-03-rusty-python/#v2--...

Re: Why is calling my asm function from Rust slower than calling it from C?

#42
post #19

Earlier quoted context omitted.

What's a language with zero complexity-cost abstractions?

Natural language. It's a language interpreted by LLMs. It is really high level.

Natural languages are much more complex.

Complex for humans: I can learn a new programming language in an afternoon and be reasonably productive in it within a week or two. I wish I could say the same for natural languages.

Complex for computers: We’ve had good compilers since the 50s. Satisfactory language models are less than five years old.

Re: Why is calling my asm function from Rust slower than calling it from C?

#43
post #21
post #2

For example, before we had something like: top: *const FFISafe > We can change that to: top: WithOffset > rust, you were meant to replace c++, not join it...

> rust, you were meant to replace c++, not join it... Turns out that not all of the C++ noise people make fun of is due to C++, sometimes the problems you want to solve with Rust or C++ is just hard to express simply to the compiler.

And then zig shows up...
Post reply on HN