7 ms·
What about in Rust? foo: Box<f32> // or &’a f32 or &f32 if borrowing Multidimensional arrays: foo: [[f32; M]; N] (These have flat storage. Howev
by armchairhacker 3y ago
What about in Rust?
foo: Box<f32> // or &’a f32 or &f32 if borrowing
Multidimensional arrays:
foo: [[f32; M]; N]
(These have flat storage. However I do assume most Rust devs use external libraries, which also have flat storage but the incompatibility issues you mentioned)
- thanatropism 3y agoI wish the Python<->Rust interop story was a little better. I learned to write some C++ for an embedded thing (smart flashlight, story for another time) and immediately started writing the Python extensions I struggled to write with Rust. (The average data science/ML-ish person encounters/figures out custom algorithms maybe three or four times a year, and three of these are fast enough with vectorization contortions. I've had two cases that were recursive and 25X faster in $fast_lang than I could possibly make in Python.)
- Thiez 3y agoCrazy to think someone would pass a single 32-bit float by reference.
- m_mueller 3y agonote: it was just an example. but in the end from a performance optimization standpoint it is a lot about what information you want to give to help the compiler along at doing its best job. with many compilers/languages that tends to be value semantics; however specifically in Fortran, which defaults to immutable reference semantics, reference types tend to be very straightforward to work together with the machine, avoid additional and keep functions inline-able. Overall from my experience this creates a more performant baseline when non-engineers work with it.