Codon Looks Very Promising For Super-Fast Python Code

Written by Michael Larabel in Programming on 17 March 2023 at 05:48 AM EDT. 34 Comments
PROGRAMMING
While there is Pyston, PyPy, and various other alternative Python implementations being done in the name of performance, Codon is one of the newer ones and is talking up 10~100x faster performance.

Codon was started by MIT researchers with an aim of delivering C/C++ like performance out of Python. Even with real-world genomics code that's been hand optimized, with Codon the researchers were seeing 5~10x speed-ups. Codon also supports a parallel back-end to support targeting GPUs or multiple CPU cores.

There is more background information on Codon available from news.mit.edu.

Codon logo


The code to Codon is made public under a Business Source License and can be found on GitHub. The project does acknowledge though that it may not work as a drop-in replacement yet among other limitations:
"While Codon supports nearly all of Python's syntax, it is not a drop-in replacement, and large codebases might require modifications to be run through the Codon compiler. For example, some of Python's modules are not yet implemented within Codon, and a few of Python's dynamic features are disallowed. The Codon compiler produces detailed error messages to help identify and resolve any incompatibilities."

More details on this Python implementation can also be found via Exaloop.io. It should be interesting for benchmarking Codon against Python 3.11 considering its recent upstream performance optimizations as well as seeing how it stacks up against some of the other performance-optimized Python implementations.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week