76
Why Python Is So Slow (And What Is Being Done About It)
(thenewstack.io)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
I have an alternative anecdote.
My coworker is a Ph.D in something domain specific, and he wrote an app to do some complex simulation. The simulation worked well on small inputs (like 10), but took minutes on larger inputs (~100), and we want to support very large inputs (1000+) but the program would get killed with out of memory errors.
I (CS background) looked over the code and pointed out two issues:
Both problems would have been solved had they used Python, but they used Fortran because "fast," but it doesn't have builtin sort or data structures. Python provides classes, sortable lists (with quicksort!), etc, so they could've structured their code better and avoided the architectural mistakes that caused runtime and memory to explode. Had they done that, I could've solved performance problems by switching lists to numpy arrays and throwing numba on the hot loops and been done in a day, but instead we spent weeks rewriting it (nobody understands Fortran, and that apparently included the original dev).
Python lets you focus on the architecture. Compiled languages often get you stuck in the weeds, especially if you don't have a strong CS background and just hack things until it works.