C is it always faster than nump?
Barry
barry at barrys-emacs.org
Fri Feb 25 18:05:54 EST 2022
> On 25 Feb 2022, at 23:00, Richard Damon <Richard at damon-family.org> wrote:
>
> On 2/25/22 2:47 PM, Chris Angelico wrote:
>>> On Sat, 26 Feb 2022 at 05:49, Richard Damon <Richard at damon-family.org> wrote:
>>> On 2/25/22 4:12 AM, BELAHCENE Abdelkader wrote:
>>>> Hi,
>>>> a lot of people think that C (or C++) is faster than python, yes I agree,
>>>> but I think that's not the case with numpy, I believe numpy is faster than
>>>> C, at least in some cases.
>>>>
>>> My understanding is that numpy is written in C, so for it to be faster
>>> than C, you are saying that C is faster that C.
>> Fortran actually, but ultimately, they both get compiled to machine code.
>
> Looking at the Github repo I see:
>
> Languages:
> Python. 62.5%
> C 35.3%
> C++. 1.0%
> Cython. 0.9%
> Shell. 0.2%
> Fortran. 0.1%
I assume that this is just for bumpy and not for all its dependencies.
That will add a lot of Fortran and c++ I expect.
>
> So there is a bit of Fortan in there, but it looks like most of the heavy lifting is in C.
>
> My guess is the Fortran is likely some hooks to add Fortran modules into the program with numpy.
>
> ...
>>> The key point is that numpy was written by skilled programmers who
>>> carefully optimized their code to be as fast as possible for the major
>>> cases. Thus it is quite possible for the numpy code to be faster in C
>>> than code written by a person without that level of care and effort.
>> This is clearly true.
>>
>> ChrisA
>
>
> --
> Richard Damon
>
> --
> https://mail.python.org/mailman/listinfo/python-list
More information about the Python-list
mailing list