Cython: The Best of Both Worlds
By Stefan Behnel, Robert W. Bradshaw, C. Citro, Lisandro Dalcin, D. S. Seljebotn, Kurt Smith. 2011
1,063 citations recorded by the source corpus.
Cython is a Python language extension that allows explicit type declarations and is compiled directly to C. As such, it addresses Python's large overhead for numerical loops and the difficulty of efficiently using existing C and Fortran code, which Cython can interact with natively.
Subfields: Artificial Intelligence, Hardware and Architecture, ML Systems & Hardware, Numerical Methods & Scientific Computing
How researchers see this paper
The researchers whose trusted networks rank it highest, strongest advocate first. Every researcher gets a different order.
In Artificial Intelligence
- Dan Roth
- Daniel Khashabi
- Mohit Bansal
- Hannaneh Hajishirzi
- Luke S. Zettlemoyer
- Percy Liang
- Quoc V. Le
- Ashish Sabharwal
In Hardware and Architecture
- A. Lewis
- Jesús Torrado
- Jonathan J. Helmus
- C. Jaroniec
- Ian Henriksen
- Shrikanth S. Narayanan
- Victor R. Martinez
- Clark W. Barrett
In ML Systems & Hardware
- A. Lewis
- Jesús Torrado
- Amos J. Storkey
- Matthew M. Graham
- K. Hebeler
- T. E. Riley
- R. Ludlam
- S. K. Greif
In Numerical Methods & Scientific Computing
- Jonathan J. Helmus
- C. Jaroniec
- Amos J. Storkey
- Matthew M. Graham
- Ian Henriksen
- K. Hebeler
- T. E. Riley
- S. K. Greif
Citations in the corpus
- Array programming with NumPy (2020, background): “Where extreme optimization is warranted, compiled languages such as Cython [43], Numba [44], and Pythran [45], that extend Python and transparently accelerate bottlenecks, can be used.”
- openTSNE: a modular Python library for t-SNE dimensionality reduction and embedding (2019, methodology): “On the other hand, we implemented critical elements of the openTSNE library in Cython (Behnel, Bradshaw, Citro, Dalcin, Seljebotn, and Smith 2011), which is subsequently transpiled into C++ , which may be able to be more aggressively optimized by the C++ compiler.”
- Astropy: A community Python package for astronomy (2013, methodology): “All time scale conversions are done by vectorized versions of the SOFA routines using Cython (Behnel et al. 2011), a Python package that makes it easy to use C code in Python.”
- Dedalus: A flexible framework for numerical simulations with spectral methods (2019, background): “Theprimary dependencies of Dedalus include: • The Numpy, Scipy, and Cython packages for Python [84, 85].”
- QuSpin: a Python Package for Dynamics and Exact Diagonalisation of Quantum Many Body Systems part I: spin chains (2016, methodology): “These libraries are then easily interfaced with Python, but can run orders of magnitude faster than pure Python code [53].”
- Cobaya: code for Bayesian analysis of hierarchical physical models (2020, methodology): “those containing long explicit loops) can also be implemented using popular just-in-time compilers or language extensions such as NUMBA [16] or Cython [17], or coded in C/Fortran and interfaced to Python.”
- Understanding Random Forests: From Theory to Practice (2014, methodology): “For critical algorithms that cannot be easily and efficiently expressed as NumPy operations, we rely on Cython [Behnel et al., 2011] to achieve competitive performance and scalability.”
- cvc5: A Versatile and Industrial-Strength SMT Solver (2022, methodology): “…centered around the Solver class, which represents a cvc5 instance and implements methods for tasks such as creating terms, asserting formulas, and issuing checks. cvc5 ’s Python API is built on top of cvc5 ’s C ++ API using Cython [29] and makes all of cvc5 ’s features accessible to Python users.”
- PyWavelets: A Python package for wavelet analysis (2019, methodology): “Cython (Behnel et al., 2011) is used to wrap the C code and implement axis-specific 1D transformations based on the low-level C routines.”
- JCVI: A versatile toolkit for comparative genomics analysis (2024, methodology): “Parsers of frequently accessed formats, such as basic local alignment search tool (BLAST) [17, 18] tabular formats, are implemented in Cython [19] for improved performance (>2× speedup) compared to a pure Python implementation.”
- Pykaldi: A Python Wrapper for Kaldi (2018, background): “Cython [8] is both a Python-like language and a compiler.”