4 ms·
>I had a few Python scripts that spend several seconds parsing larger files, after a rewrite to c++ that changed to almost instant. Was it worth rewriting thos
by rndgermandude 6y ago
>I had a few Python scripts that spend several seconds parsing larger files, after a rewrite to c++ that changed to almost instant.
Was it worth rewriting those scripts in C++? I'm not trying to be facetious; a few seconds (or minutes) of additional runtime for scripts you hardly ever run or even run only once doesn't really matter, but running such scripts often may then worth the effort to convert them to something faster.
I regularly find myself porting regularly used python/js scripts to C#/dotnet (because it's fast enough, has good collections + LINQ for your somewhat-functional-programming needs and I can skip manual memory management, and async/await programming is not perfect but available and easy enough, + nuget has a lot of stuff and so does the standard lib).
What made you pick C++ over e.g. go or rust or C#?
- josefx 6y ago> Was it worth rewriting those scripts in C++? Mostly for development, I ended up invoking the script quite often and had to wait for the results. In production the input it ran on only changed once a week, so there was no need to run it often. I most likely tried to run it with Pypy first, thought I am not 100% sure on that. If I ran into a similar issue today I would first try to compile it with Cython as I already try to use type annotations in every new script I write. > What made you pick C++ over e.g. go or rust or C#? Most of the project was already C++ and I only had to link in an Xml library for some of the output.