Re:Show HN: Python at the Speed of Rust
by nsethi89 on Wednesday April 09, 2025 @10:59AM
(#43632915)
how come performance is worse than Rust? Isn’t this misleading
[ Parent
| on HN ]
Re:Show HN: Python at the Speed of Rust
by olokobayusuf on Wednesday April 09, 2025 @11:06AM
(#43632974)
It's marginal. The difference exists because Function adds syntactic sugar to make the developer experience of calling the compiled functions easy and smooth. The Function call isn't a direct call; whereas the Rust one is.
It's possible to hack Function to perform a direct call and avoid (most of) the overhead, but in 99.99% of use cases this won't matter cos most processing time will be spent in the body of the function, not the scaffolding that Function uses.
Yeah, Python at the Speed of Rust if you ignore the unavoidable overhead of still using Python.
Re:Show HN: Python at the Speed of Rust
by olokobayusuf on Sunday April 13, 2025 @08:41AM
(#43672354)
There's actually no overhead of "still using Python" because we don't use Python. The overhead in Function exists solely because we have a bunch of sugar added to create a unified interface for calling different kinds of functions (i.e. generator functions, etc).
You don't have to take my word for it: you can pull the C++ source code that we generate from a given Python function and inspect it yourself: https://docs.fxn.ai/predictors/compiler#compiling-binaries