mirror of
https://github.com/exaloop/codon.git
synced 2025-06-03 15:03:52 +08:00
* Fix gitignore, versions * Add caching (WIP) * Fix decorator * Refactor * Support tuple conversions * Fix void; allow pyobj default conversion * Improve setup * Rename * Fix JIT output capturing * Support conversion of "complex" * Allow class conversions * Use Python number API * Use Python API for (get/set/del)item * Add decorator docs * Cleanup * Support slice and optional conversions * Add comparison magics * Remove Optional.__invert__() method * Fix tests * Fix test * Add release notes * New pybridge tests * Update decorator tests * Fix optional tuple handling * Fix optional str() and repr() * Add more decorator tests * Fix optional.__bool__ * Update releases.md * Add op tests * Organize release notes [skip ci] * clang-format [skip ci] * Add r-magics to pyobj; more tests [skip ci] * More pybridge tests * Add plugin library paths to build command * Remove walrus operator [skip ci] * Fix optional operator handling; Fix right-magic handling Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com> Co-authored-by: Ibrahim Numanagić <inumanag@users.noreply.github.com>
Codon is a high-performance Python compiler that compiles Python code to native machine code without any runtime overhead. Typical speedups over Python are on the order of 100x or more, on a single thread. Codon supports native multithreading which can lead to speedups many times higher still.
The Codon framework is fully modular and extensible, allowing for the seamless integration of new modules, compiler optimizations, domain-specific languages and so on. We actively develop Codon extensions for a number of domains such as bioinformatics and quantitative finance.
Codon at a glance
A simple Python program fib.py
...
from time import time
def fib(n):
return n if n < 2 else fib(n - 1) + fib(n - 2)
t0 = time()
ans = fib(40)
t1 = time()
print(f'Computed fib(40) = {ans} in {t1 - t0} seconds.')
... run through Python and Codon:
$ python3 fib.py
Computed fib(40) = 102334155 in 17.979357957839966 seconds.
$ codon run -release fib.py
Computed fib(40) = 102334155 in 0.275645 seconds.