|
|
|
|
|
by rented_mule
8 days ago
|
|
I rewrote a C++ batch process in Python 1.4 (this was 1997) and the Python version was ~10x as fast. The port was pretty direct, function for function. It was even line for line where language and library differences didn't offer an easier way. I was just trying to see if Python was so slow that we couldn't consider using it in production, and this was the most speed critical batch we had. I assumed the speed difference was a bug that was skipping work, but that seemed unlikely because the output was correct. It turned out to be a bug in the C++ code that was needlessly reproducing work (an issue with cache keys). The bug was extremely subtle. When I fixed the C++, there was very little difference in speed as the batch was I/O bound when the cache was working. So, adding to your point, sometimes you can greatly improve speed by rewriting in a slower language, even without performance in mind. |
|
But also technically I think your point still stands. Because rewriting it helped you find a defect in the original. Which did improve performance of the original.
It’s quite interesting the two implementations performance was so close in the end. Do you consider one implementation “better” for non-performance reasons? Maybe one type of dev is easier to find. Or one language is easier to create and maintain correctly behaving programs in your environment?