Python, C++ interaction

wesleiramos2 at gmail.com wesleiramos2 at gmail.com
Fri Dec 5 17:17:15 EST 2014


Em quinta-feira, 4 de dezembro de 2014 07h51min14s UTC-2, Sturla Molden  escreveu:
> Dan Stromberg <drsalists at gmail.com> wrote:
> 
> > 1) writing in Cython+CPython (as opposed to wrapping C++ with Cython)
> 
> That is an option, but it locks the code to Cython and CPython forever. C
> and C++ are at least semi-portable.
> 
> > 2) using numba+CPython (It's a pretty fast decorator - I've heard it's
> > faster than Cython)
> 
> Numba is usually not "faster than Cython" (Cython can be as fast as C), but
> it can be pretty fast. Sometimes it is comparable to -O2 in C for the
> subset of Python it supports, but usually a bit slower. But if you can use
> it, it is easier to use than Cython. There are no extra compilation steps,
> etc. Just add a couple of decorators to the Python code and it takes off
> like a rocket. For anyone who are familiar with PyPy and Psyco, Numba is
> far better than those. It is a Python JIT compiler that often can perform
> better than the Java VM. Numba will also JIT-compile Python code that uses
> ctypes or cffi to call external libraries down to almost zero overhead.
> 
> You forgot to mention using Fortran and f2py. Many scientists and engineers
> prefer Fortran to C and C++ because it is easier to use. And Fortran 90 and
> later standards are not anything like the loathed Fortran 66 and 77
> languages. Fortran is a high-level language particularly suited for
> numerical computing, C is a semi-portable high-level assembler. 
> 
> Sturla

m'giu vous êtès nom souris, pseudo nom cha'rs out oiu êtès, i'ret egop c'hâse



More information about the Python-list mailing list