3 ms·
>And then you have to rewrite your script in a faster language, like C++ or Rust. I've observed speedups on the order of 20x this way. My assumption of possibl
by carlmr 8y ago
>And then you have to rewrite your script in a faster language, like C++ or Rust. I've observed speedups on the order of 20x this way.
My assumption of possible speedups (from past experience) is roughly.
Python -5x-> Perl -2x-> C#/F# -5x-> C++ -2x-> Rust
Rust is usually a lot faster than C++, because in my data wrangling I often need a lot of string operations that are much easier to do with zero-allocation in Rust than in C++. While you can write the same in C++ it becomes very hard to manage without the borrow checker.
I don't like Perl, so I basically never use that, and I find it's easier to write something that works in Rust than in C++. So usually I'll pick F# or Rust, depending on how fast it needs to be and how easy it needs to be to write it. F# is super nice for writing and Ionide code completion is just miles ahead of Rust code completion at this point. Being forgetful I barely need to look anything up in F#, but in Rust I always need to look at the docs. This will probably improve in the future (I hope). If Rust code completion becomes amazing I think I won't even start in Python anymore. (Pandas is the only thing that pulls me back into Python usually).
- nerpderp82 8y agoAn F# like language hosted within Rust would be a dream. With a GC and stack allocation, optional lifetime annotations when you want to remove the GC overhead.
- carlmr 8y agoI think with the newer versions of F# you can do some manual memory management if needed.