4 ms·
how come performance is worse than Rust? Isn’t this misleading
by nsethi89 2y ago
how come performance is worse than Rust? Isn’t this misleading
- olokobayusuf 2y agoIt'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.
- IshKebab 2y agoYeah, Python at the Speed of Rust if you ignore the unavoidable overhead of still using Python.
- olokobayusuf 2y agoThere'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 https://docs.fxn.ai/predictors/compiler#compiling-binaries