Replies: 1 comment 1 reply
-
|
I'm curious if you ever found a nice solution to this issue? Or if the answer essentially is: more rust |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
For context I have a library written in Python designed for Python. Parts of it are now written in Rust (where it has enhanced performance). I would like to transition more to Rust to continue to speed things up. Creating a fully functioning Rust replicable library is, however, only a secondary goal and not the primary.
The challenge I have is that the bottlenecks end up being in a high layer so to get to those I need to port every lower layer and dependent object to Rust first in order to both maintain compatibility and allow calculations to occur in Rust. But this can introduce slowdowns.
Here is a concrete example. Suppose I create some (supposed) immutable data object in Python and time its data fetching usage...
If I now port these objects to Rust, there is overall degradation of performance of using them due to the TypeConversion cost and memory
clone. Unless the...calculationpart of this makes up some speed it is not really a very good atomic addition.In Python I now achieve the speeds:
For simple float types this isn't that bad but the
datetime/NaiveDateTimeis much weaker (and these lists are very small).I am considering providing an interim solution by using cached Python wrappers.
This allows reasonable preservation of speed in Python but the struct is directly available in Rust to continue to perform calculations there. Problem is its quite a bit of work and requires very careful structuring.
Is there another design pattern besides this that I am missing, or is my line of thinking broadly on the right track?
Beta Was this translation helpful? Give feedback.
All reactions