Basic Python Questions - Oct. 31, 2013

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


Chris Angelico <rosuav at gmail.com> writes:

> On Fri, Nov 1, 2013 at 12:17 AM, Alain Ketterlin
> <alain at dpt-info.u-strasbg.fr> 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).
>
> Well, they may not be simple to do, but chances are you can push the
> work down to the CPU/FPU on most modern hardware - that is, if you're
> working with IEEE floating point, which I'm pretty sure CPython always
> does; not sure about other Pythons. No need to actually calculate trig
> functions unless you need arbitrary precision (and even then, I'd bet
> the GMP libraries have that all sewn up for you). So the language
> doesn't make a lot of difference.

Well, sure, yes, I agree with you and hope they are left to the FP
engine (still, fp ops are often multi-cycle, but that's a minor point).

But what I meant was: a (bytecode) interpreted program will always be
slower than a compiled program, probably by an order of magnitude when
doing number crunching.

-- Alain.



More information about the Python-list mailing list