Cython
graalpython
Our great sponsors
Cython | graalpython | |
---|---|---|
78 | 13 | |
8,801 | 1,095 | |
1.5% | 3.0% | |
9.8 | 10.0 | |
7 days ago | 1 day ago | |
Python | Python | |
Apache License 2.0 | GNU General Public License v3.0 or later |
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.
Cython
-
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
-
Codon: A high-performance Python compiler
How does this relate to
?
Would it be possible to write performance-sensitive parts of a Python system in Codon and link that to a CPython or PyPy runtime that supports more dynamic features?
graalpython
-
socketify.py - Bringing WebSockets, Http/Https High Peformance servers for PyPy3 and Python3
HPy integration to better support CPython, PyPy and GraalPython
-
Oracle Contributing GraalVM Community Edition Java Code to OpenJDK
Here are some nice examples: https://www.graalvm.org/22.2/reference-manual/python/Interop...
This may be more readable: https://github.com/oracle/graalpython/blob/master/docs/user/...
-
Pyjion – A Python JIT Compiler
Isn't this what the GraalVM [1] guys are also trying to do? Seems like today the competition is between who is more polyglot than the other, JVM, CLR or WASM.
- Python stands to lose its GIL, and gain a lot of speed
- A viable solution for Python concurrency
- RustPython: A Python interpreter written in Rust
-
Stack Overflow Developer Survey 2021: "Rust reigns supreme as most loved. Python and Typescript are the languages developers want to work with most if they aren’t already doing so."
Graalpython is slowly taking shape, although it's still very alpha: https://github.com/oracle/graalpython
- Launch HN: Enso (YC S21) – Visual programming and workflow tool for data science
-
AST based scripting languages
https://github.com/oracle/graalpython is an AST interpreter for Python
-
Pyston v2.2: faster and open source
I'd say graal is even less mature than Pyston. See https://github.com/oracle/graalpython/tree/master/docs/user
> At this point, the Python runtime is made available for experimentation and curious end-users.
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