Plurrrr

Fri 24 Mar 2023

Speeding up text processing in Python (is hard)

If you’re doing text or string manipulation in Python, what do you do if your code is too slow? Assuming your algorithm is reasonably efficient, the next step is to try faster alternatives to Python: a compiled extension.

Unfortunately, this is harder than it seems. Some options don’t offer an easy path to optimizations, others are actually slower. To see this limitation in action, we’ll consider some alternatives:

  • Pure Python, with the default Python interpreter.
  • Cython.
  • mypyc.
  • Rust.
  • Pure Python, with the PyPy interpreter.

We’ll also consider what can be done if these option don’t help.

Source: Speeding up text processing in Python (is hard), an article by Itamar Turner-Trauring.

How Big Should a Programming Language Be?

Reading the thought-provoking "Patterns & Abstractions" post reminded me of a long-held opinion I have about programming language design: we have a tendency to keep adding features to a language until it becomes so big that its sheer size makes it difficult to use reliably. Since most of us spend most of our time programming in one language, it can be difficult to see a common trend amongst languages in general.

Source: How Big Should a Programming Language Be?, an article by Laurence Tratt.