summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2021-04-29 13:37:37 +0200
committerStefan Behnel <stefan_ml@behnel.de>2021-04-29 13:37:37 +0200
commitec086a889fdebe08dad1f1fd627e14d4f8c541f1 (patch)
treece41cb3758fc029b7deef4a41f0aef9c6d6923cf /README.rst
parentbea2bdac844027e8652077e8d3af40d435e1698c (diff)
downloadcython-ec086a889fdebe08dad1f1fd627e14d4f8c541f1.tar.gz
Add sort of a "Related Work" section to the github readme that references and compares other Python compiler projects.
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst67
1 files changed, 67 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index 6b9c9f773..0f56f5661 100644
--- a/README.rst
+++ b/README.rst
@@ -54,6 +54,73 @@ We are currently building the next great Cython edition:
You can help us make the life of Python 3.x users easier.
+Differences to other Python compilers
+-------------------------------------
+
+Started as a project in the early 2000s, Cython has outlived
+`most other attempts <https://wiki.python.org/moin/PythonImplementations#Compilers>`_
+at producing static compilers for the Python language.
+
+Similar projects that have a relevance today include:
+
+* `PyPy <https://www.pypy.org/>`_, a Python implementation with a JIT compiler.
+
+ * Pros: JIT compilation with runtime optimisations, fully language compliant,
+ good integration with external C/C++ code
+ * Cons: non-CPython runtime, relatively large resource usage of the runtime,
+ limited compatibility with CPython extensions, non-obvious performance results
+
+* `Numba <http://numba.pydata.org/>`_, a Python extension that features a
+ JIT compiler for a subset of the language, based on the LLVM compiler
+ infrastructure (probably best known for its ``clang`` C compiler).
+ It mostly targets numerical code that uses NumPy.
+
+ * Pros: JIT compilation with runtime optimisations
+ * Cons: limited language support, relatively large runtime dependency (LLVM),
+ non-obvious performance results
+
+* `Pythran <https://pythran.readthedocs.io/>`_, a static Python-to-C++
+ extension compiler for a subset of the language, mostly targeted
+ at numerical computation. Pythran can be (and is probably best) used
+ as an additional
+ `backend for NumPy code <https://cython.readthedocs.io/en/latest/src/userguide/numpy_pythran.html>`_
+ in Cython.
+
+* `mypyc <https://mypyc.readthedocs.io/>`_, a static Python-to-C extension
+ compiler, based on the `mypy <http://www.mypy-lang.org/>`_ static Python
+ analyser. Like Cython's
+ `pure Python mode <https://cython.readthedocs.io/en/latest/src/tutorial/pure.html>`_,
+ mypyc can make use of PEP-484 type annotations to optimise code for static types.
+
+ * Pros: good support for language and PEP-484 typing, good type inference,
+ reasonable performance gains
+ * Cons: no support for low-level optimisations and typing,
+ opinionated Python type interpretation, reduced Python compatibility
+ and introspection after compilation
+
+* `Nuitka <https://nuitka.net/>`_, a static Python-to-C extension compiler.
+
+ * Pros: highly language compliant, reasonable performance gains,
+ support for static application linking (similar to
+ `cython_freeze <https://github.com/cython/cython/blob/master/bin/cython_freeze>`_)
+ * Cons: no support for low-level optimisations and typing
+
+In comparison to the above, Cython provides
+
+* fast, efficient and highly compliant support for almost all
+ Python language features, including dynamic features and introspection
+* full runtime compatibility with all still-in-use and future versions
+ of CPython
+* "generate once, compile everywhere" C code generation that allows for
+ reproducible performance results and testing
+* C compile time adaptation to the target platform and Python version
+* support for other C-API implementations, including PyPy and Pyston
+* seamless integration with C/C++ code
+* broad support for manual optimisation and tuning down to the C level
+* a large user base with thousands of libraries, packages and tools
+* almost two decades of bug fixing and static code optimisations
+
+
Get the full source history:
----------------------------