3 ms·
I would recommend Rust even if writing a simple tool, the kind of thing I might previously have used python for. We had some data munging to do and someone star
by lowbloodsugar 4y ago
I would recommend Rust even if writing a simple tool, the kind of thing I might previously have used python for. We had some data munging to do and someone started it in python. On the real dataset it ran for an hour then ran out of memory. I took a crack in rust, as a n00b rust programmer, and the rust version runs successfully in less than a minute. I haven’t tried server side yet, because the learning curve for that is more of a learning cliff, but for small things I am already faster in rust than with my decade of python.
- queuebert 4y agoCompletely agree. Rust shines as a language for small tools that need to be performant and correct, like Unix utilities. Exa and fd are great examples of this.
- HeyImAlex 4y agoI had the same experience with go, 100x performance improvements on data crunching scripts with roughly the same code. Worst part of writing it in python was simple misspellings in the last stages of the computation breaking things.
- vonseel 4y ago> Worst part of writing it in python was simple misspellings in the last stages of the computation breaking things. I'm not sure I understand. Was the typo in something like a dict key? Or did you add two of the wrong variables together? How did another language protect you from this? I fail to see how you couldn't also add two of the wrong variables (with the correct type) together in a different language.
- HeyImAlex 4y agoPython (out of the box) will only complain about missing variables or methods at runtime.
- vonseel 4y ago>for small things I am already faster in rust than with my decade of python. That seems like a bold claim? I've also been writing Python for a decade and it takes no time at all to whip up a small script. I have no doubts the Rust version will be much faster, but stepping into a new language would take me at least longer to write the script than an equivalent version in Python. Plus there's all the other stuff to learn. Once you get past learning the basic syntax (creating variables, loop structure, assignment/etc.), you still have to pick up new things, like executing your work with parallelism, downloading files, parsing and dumping JSON, connecting to databases... Each new topic introduces a bunch of stuff that takes a little bit to figure out. I guess you could get through most of it in a few hours though if you had the right problem to work on. But still, there's the muscle memory aspect. Can a new language really sink in so fast that it's faster to use than Python after 10 years of writing Python?