Codon, a Python Compiler written with C++ and LLVM
High performance and no overhead! In a test I did, the performance gain was greater than 600%.
Codon is a high-performance Python compiler that compiles Python code to native machine code without any runtime overhead.
In the case of Linux just run this command below:
You must have cURL installed.
At the end of the installation it will ask you to confirm the addition of the binary to your
$PATH variable, press
y for yes. If it doesn’t work, even opening it in a new terminal, as he advises, run the following commands:
To test run:
Suppose you have this code Python which is a Fibonacci function, you can interpret the code with Codon itself:
To run without compiling:
However, the performance will not be very good. The correct thing is to compile this code to a binary and then run the binary, example:
You can still compile with [LLVM] optimization(https://terminalroot.com/tags#llvm)
Analyzing the performance
When we used a
for loop with 1 million cycles in Python, as we did in this video, Codon was about 600% faster than native interpreter (version
Test file/code can be obtained here.
That is, actual execution: more than 6 seconds. 😞
Actual execution: in less than 1 second!!! 😲