[Tutor] Hi there :.)

Stefan Behnel stefan_ml at behnel.de
Tue Mar 16 17:33:08 CET 2010


Alan Gauld, 15.03.2010 20:28:
> <mark-ireland at msn.com> wrote
>> (apparently python is slow ?!?).
>
> It is all relative. If you want to write fast moving graphics etc then
> yes, you probably need C++. For anything else you might find Python is
> fast enough.

A good approach tends to be: write it in Python first, benchmark it, find 
out *if* it's too slow. If so, find out *what* exactly is too slow, 
optimise that code, benchmark again. Iterate. If there are still parts that 
are too slow, move the 1-5% of your code that are most time critical into 
Cython. Benchmark, optimise. Iterate. And only *then*, move on to plain 
C/C++ if you can really prove with verified benchmarking numbers that you 
need to. In almost all cases, you don't. In any case, it will safe you all 
of the hassle of writing the entire code in C/C++, which usually safes you 
weeks, months or years of developer time, depending on the complexity of 
your application.

Stefan



More information about the Tutor mailing list