codon
Cython
Our great sponsors
codon | Cython | |
---|---|---|
34 | 79 | |
13,809 | 8,862 | |
0.9% | 1.3% | |
7.9 | 9.8 | |
12 days ago | 7 days ago | |
C++ | Python | |
GNU General Public License v3.0 or later | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
codon
- Should I Open Source my Company?
-
Python running on the Dart VM?
I found at least one project that managed to compile python AOT to LLVM https://github.com/exaloop/codon. Even if LLVM is more expressive than Dart Kernel, that should at least be some evidence that this might not be too impractical.
-
Codon: Python Compiler
Repo for more details: https://github.com/exaloop/codon
> What is Codon?
> 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 10-100x or more, on a single thread. Codon's performance is typically on par with (and sometimes better than) that of C/C++. Unlike Python, Codon supports native multithreading, which can lead to speedups many times higher still. Codon grew out of the Seq project.
> What isn't Codon?
> 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.
> Codon can be used within larger Python codebases via the @codon.jit decorator. Plain Python functions and libraries can also be called from within Codon via Python interoperability.
Their fannkuch benchmark seems to be a bit dishonest. They claim an enormous perf delta on https://exaloop.io/benchmarks.html but fannkuch uses factorial a lot and they define factorial with a very small (n=20) table: https://github.com/exaloop/codon/blob/fb461371613049539654c1...
Disclaimer: I've worked on several Python runtimes and compilers, but I'm not by any means out to get Codon. Just happened across this by accident while looking at their inline LLVM, which is neat.
-
Mojo – a new programming language for all AI developers
Another "Python with high-performance compiled builds" would be https://github.com/exaloop/codon.
-
Is there a way to use turn a project into a single executable file that doesn't require anyone to do anything like install Python before using it?
Try Codon? https://github.com/exaloop/codon
- Since when did Python haters spread out everywhere? Maybe DNF5 would be faster because of ditched it, maybe.
- What are your thoughts on Codon compiler having a paid licence?
-
Python-based compiler achieves orders-of-magnitude speedups
nit: 'Python-based' would imply to me that it's written in Python, but it looks like it's mostly C++ & LLVM:
- Show HN: Codon: A Compiler for High-Performance Pythonic Applications and DSLs [pdf]
Cython
- Ask HN: C/C++ developer wanting to learn efficient Python
-
Never again
and again, everything that was released after using an older version of cython.
Packages using cython (note the linked issues) due to this change.
-
Codon: Python Compiler
Just for reference,
* Nuitka[0] "is a Python compiler written in Python. It's fully compatible with Python 2.6, 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10, and 3.11."
* Pypy[1] "is a replacement for CPython" with builtin optimizations such as on the fly JIT compiles.
* Cython[2] "is an optimising static compiler for both the Python programming language and the extended Cython programming language... makes writing C extensions for Python as easy as Python itself."
* Numba[3] "is an open source JIT compiler that translates a subset of Python and NumPy code into fast machine code."
* Pyston[4] "is a performance-optimizing JIT for Python, and is drop-in compatible with ... CPython 3.8.12"
-
Any faster Python alternatives?
Profile and optimize the hotspots with cython (or whatever the cool kids are using these days... It's been a while.)
-
Python executable makers
Cython - - embed demo
-
Been using Python for 3 years, never used a Class.
There are also just-in-time compilers available for some Python features, that compile those parts to machine code. That includes Numba (usable as a library within CPython) and Pypy (an alternative Python implementation that includes a JIT compiler to improve performance). There’s also Cython, which is a superset of Python that allows more directly interfacing with C and C++ functions, and compiling the resulting combined code.
- Python-based compiler achieves orders-of-magnitude speedups
-
Surprising Consequences of macOS’s Environment Variable Sanitization
Conceptually, Cython is mainly for accelerating Python code, and can _also_ access C code. Meanwhile CFFI is specifically for calling C code and nothing else. I recommend the video for the differences.
One concrete thing that pops to my mind is that Cython doesn't support Py_LIMITED_API which means that you need to ship a lot more binary wheels. At least the issue is still open (https://github.com/cython/cython/issues/2542) and Cython projects IME need new wheels for each minor Python release. Compare that to cffi projects that (musl & pypy aside) only have to ship wheels for one Python version / architecture: https://pypi.org/project/argon2-cffi-bindings/#files
-
Starlite development updates January ’23
As you can see, in this benchmark Starlite handily beats even blakchseep, a notoriously fast ASGI framework written in Cython
What are some alternatives?
SWIG - SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.
PyPy
mypyc - Compile type annotated Python to fast C extensions
Pyston - A faster and highly-compatible implementation of the Python programming language.
Stackless Python
Pyjion
jax - Composable transformations of Python+NumPy programs: differentiate, vectorize, JIT to GPU/TPU, and more
dramatiq - A fast and reliable background task processing library for Python 3.
V8 - The official mirror of the V8 Git repository
fastapi - FastAPI framework, high performance, easy to learn, fast to code, ready for production
ctypes.sh - A foreign function interface for bash.
PeachPy - x86-64 assembler embedded in Python