[PyKDE] Language Overhead: C++ vs Python

Torsten Marek shlomme at gmx.net
Wed Apr 6 13:57:46 BST 2005

Hash: SHA1

Wido Depping schrieb:
> On Apr 6, 2005 2:24 PM, Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
>>>From time to time we get commissioned to develop Python bindings for Qt
>>based widget sets. These often come with examples and part of the work is
>>to port those examples to Python. We then end up with C++ and Python
>>implementations with the same structure, the same functionality, and
>>calling the same API. Any difference in the amount of code is purely down
>>to "language overhead".
>>Below is a comparison of the numbers of lines of code for a number of such
>>examples. For the C++ implementations I have excluded all .pro files and
>>all qmake and moc generated files.
>>             C++   Python   Reduction
>>example_1    509     318       38%
>>example_2    871     516       41%
>>example_3    225     132       41%
>>example_4    142      72       49%
>>example_5    615     363       41%
>>example_6     56      46       18%
>>example_7   1445     764       47%
>>example_8    536     312       42%
> Hi Phil,
> These are indeed nice results. But how is the performance of the
> python implemented widgets? I've never done one myself and I wonder if
> there is any visible speed difference.
When I've got more time on my hands, I'll write a small report of a Python
refactoring/porting-to-C++ task I had in an internship job last months.

I think that the bigger problem is the memory usage of Python vs. C++ widgets,
but with the share of memleaks fixed in the last weeks, it got definitely better.
> By the way, are there any Python-implemented widgets available on the
> net? There are some nice widgets in KDE (like Date selector), I would
> like to integrate into my application. But I don't want my application
> depend on PyKDE, since I want it to be portable on Unix, Mac OS X and
> Windows.

I sometimes thought about a widget collection for PyQt, something nice for a
contrib/ section in the PyQt distribution.


- --
Torsten Marek <shlomme at gmx.net>
ID: A244C858 -- FP: 1902 0002 5DFC 856B F146  894C 7CC5 451E A244 C858
Keyserver: subkeys.pgp.net

Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org


More information about the PyQt mailing list