announcing fython
Raoul Fleckman
raoul.fleckman at gmail.com
Sat Oct 1 23:56:23 EDT 2016
On 2016-10-02, nicolasessisbreton at gmail.com <nicolasessisbreton at gmail.com>:
> **How does this compare to Python+Numpy?
> **How much faster is Fython, and what are the restrictions on the
> **Python code?
>
> Python+Numpy allows easy processing of vector, but there is a limit to
> how much user-defined logic can be used with Numpy. For example,
> operating on three different arrays to do something like
>
> if x[i] > 0 :
> temp = get_value( y[i] )
>
> if temp > 0:
> z[i] = another_operation( z[i] )
>
> may require three different Numpy calls.
> With Fython, the if statements and the loop around them is directly
> compiled to machine code.
> Fython speed is the same as Fortran speed.
>
> In some applications, I get a speed-up of 100 compared to Cython, and
> a speed-up of 10 compared to C.
>
> I'm not a Cython nor a C expert, and I know that with some good
> compiler flags, one may make the performance of these two languages
> similar two Fortran. The advantage of Fython is that everything is
> tune out-of-box because of its connection to Fortran.
>
> There is no restriction on the Python code.
> Once a Fython program is avalaible, Python can throw any scalar or
> Numpy array at it.
>
> **whether Fython is pass by reference (Fortran) or value
> **and then there's the 'little' matter of one-based (Fortran) or
> **zero-based (python) arrays?
>
> Fython is passed by reference, so that any modification made to a
> variable in Fython is propagated back to Python.
>
> Fython follows Fortran syntax and is one-based by default.
> This doesn't give any interop problem with Python, because what
> matters is to know the pointer to the first element of an array, and
> Fython knows it.
>
> For the programmer convenience, like Fortran, Fython allows the choice
> between one-based and zero-based indexing at array declaration.
Thank you! it sounds very interesting indeed, particularly for those of
us with a substantial Fortran code base which needs to be updated.
Please keep us posted on your progress!
More information about the Python-list
mailing list