[math4] pure python may be a bad idea
tomeu at sugarlabs.org
Tue Mar 31 06:05:22 EDT 2009
2009/3/31 Wade Brainerd <wadetb at gmail.com>:
> On Mon, Mar 30, 2009 at 5:32 PM, Christian Horne <blendmaster1024 at gmail.com>
>> ... and why?
>> because python is relatively slow.
>> i'm not saying that python in general is bad, but everything that can be
>> coded as a C/C++ PYModule probably should be, as python is noticably
> Hey Christian,
> If you think about what the Python code is actually doing, this isn't really
> true. We're not crunching numbers or doing heavy 3D transformation or
> image processing.
> In Sugar activities, Python code executes effectively instantly. All the
> hard work happens inside Cairo, Pygame, the X driver, Numeric, etc. which
> are already all written in C.
> Take it from me, two of my Sugar activities (Colors! and Bounce) rely on C
> extension modules. In both cases, I stayed in Python as long as I could
> before moving anything to C. With tools like SWIG available, it's an easy
> transition to make if you found find you need to.
>> i can say this for sure, not just because of all the places you hear that
>> interpreted is slower (and i'm not saying they're wrong) but because
>> XFCE runs at least 2x faster on my XO than sugar does.
> Sugar's performance has a lot more to do with what its Python code is doing
> than the fact that it's running Python. Not enough attention has been paid
> to optimizing it.
+1 from someone who has spent lots of time understanding the
performance behavior of Sugar.
More information about the FourthGradeMath