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.

An example task: name matching

In order to have something to measure and discuss, we will consider a concrete example: matching people’s names.

You are a volunteer with the

 

 

 

To finish reading, please visit source site