I program in Python and hear it all the time "Python is too slow"!

For some reason, the Julia community loves to write articles and social media posts about how Python is slow. Then you have some classically trained coders in Fortran or C that are often sceptical.

Here's why the argument is a bit tired.

Supercharge Python with Numpy and Numba

Python's super-power is its ecosystem.

Simply import numba and you can supercharge critical code in a single command. Most programs have bottlenecks, using just-in-time compilation with Numba on those parts can bring the computation up to C performance easily. With Cython you can even take specifically written code to compilation

We all remember the Numerical Cookbook. Python has other libraries like Numerical Python import numpy that implement most of these recipes in C, available through easy Python commands. What's more, it's all vectorized code!

The ecosystem brings many performance features to Python for free.

Slow is not Always Bad

Controversial I know, but hear me out!

When you write a solution in slow code, suddenly inefficiencies become very apparent. Python sometimes forces you to learn about big O notation and data structures to work efficiently, where a compiled language would only see a difference of milliseconds.

In my controversial opinion writing in a faster language should usually be the last optimization step.

Rapid Iteration

Vanilla Python may be slower to execute, but fast to develop!

The inbuilt legibility of Python and productivity tools like black, flake8, and tabnine make it easy to rapidly iterate on code. Whether it's a prototype or a full development project, the low barrier of Python makes changes easy to implement.

This also holds for learning programming in Python quickly.


Thanks to Duncan Irving for the inspiration for this essay.

Image of Atomic Essay Day 34 - Python is slow! Or is it?!

This atomic essay was part of the October 2021 #Ship30for30 cohort. A 30-day daily writing challenge by Dickie Bush and Nicolas Cole. Want to join the challenge?