Basic Python Questions - Oct. 31, 2013

Alain Ketterlin alain at dpt-info.u-strasbg.fr
Thu Oct 31 10:31:02 EDT 2013


Mark Lawrence <breamoreboy at yahoo.co.uk> writes:

> On 31/10/2013 13:17, Alain Ketterlin wrote:
>> "E.D.G." <edgrsprj at ix.netcom.com> writes:
>>
>>>        The calculation speed question just involves relatively simple
>>> math such as multiplications and divisions and trig calculations such
>>> as sin and tan etc.
>>
>> These are not "simple" computations.
>>
>> Any compiled language (Fortran, C, C++, typically) will probably go much
>> faster than any interpreted/bytecode-based language (like python or
>> perl, anything that does not use a jit).
>>
>
> From http://docs.python.org/3/library/math.html "CPython
> implementation detail: The math module consists mostly of thin
> wrappers around the platform C math library functions."

Of course, at the end, you need to do the computation.

I was not clear enough. I meant: the time taken by the bytecode
interpreter is probably larger than the time taken to compute the
result (and not only for +).

> There's only one way I know of to find if it's actually fast enough
> and that's test it.

Whether they are "fast enough" or not is another question and depends on
the application. It seems that the OP feels they are not fast enough (in
perl, but I see no reason why it would be better in python).

-- Alain.



More information about the Python-list mailing list