You can use another environment for the language (most likely, you have CPython). This is a fairly serious step but the effect should be appropriate. Or you may rewrite the existing Python code, optimizing it for greater speed. This of course will require a lot of work.
Here are five projects that attempted to solve this problem in one of two ways.
Among all members for the replacement of CPython, PyPy is the most prominent. Quora for example uses it on production. Perhaps it has all chances to become the default environment due to its excellent compatibility with the existing code.
This project was sponsored by Dropbox which uses the LLVM (Low Level Virtual Machine) infrastructure for the compiler that also uses JIT. If you compare with PyPy, Pyston is still only at the initial level of development at the current version of 0.5.1 and it does not support all the features of the language.
Rather than increasing the performance of the bytecode compiler and the Python interpreter some developers have decided that the Python code can be translated into other languages that are already executing themselves quickly. So did the Nuitka team, their project compiles Python programs into C ++ code. Implementation largely relies on the existing binaries of the Python environment which somewhat limits the portability of the project but do not underestimate the speed increase that such a translation provides. In the future authors plan to translate Python directly into C (although it plans for a very distant future) which will speed up the speed of many more times.
Cython is a superstructure over Python. It’s a special version of the language that is compiled into C and interfaces with C / C ++ code. This is one of the ways to write C extensions for Python so that code sections that require special speed can be implemented. However, it can be used separately from conventional Python. The reverse side of the coin is that the transfer of the existing code base will not be fully automatic. Technically, you’re no longer writing in Python. Cython is widely used and used in many libraries. Some algorithms in scikit-learn are written exactly on Cython to improve performance.
Numba consists of several previous approaches. From Cython, it takes the idea that parts of the language require the most (for example, mathematical calculations tied to the CPU) should be accelerated. Just like PyPy or Pyston it does this with LLVM. The functions compiled by Numba can be marked with special decorators and Numba will work on their acceleration with NumPy. Keep in mind that Numba does not use JIT so the compilation takes more time.