Re: [pygtk] Overriding GObject methods in Python



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hrvoje Nikšić wrote:
> On Thu, 2006-11-23 at 17:20 +0100, Johan Dahlin wrote:
>> You seem to be very worried about performance. 
> 
> Only for low-level code, where C would be used for efficiency.  Ideally,
> calling C methods from C code should be as fast as invoking a function
> via a function pointer (possibly achieved by caching the method lookup).
> Calling Python from C or C from Python can involve hashtable lookups,
> performance is obviously not a priority there.
> 
>> I advise you to try it out and see if it meets your requirements.
>>
>> If it doesn't, rewrite the whole thing in C.
> 
> Your advice is sound and it works well for most projects.  For some
> larger projects a bit more planning is needed because by the time the
> project reaches a prototype stage, it might be too late to rewrite it in
> C.
> 
> In the case of the project I'm working on, the prior code base was
> written in Scheme, using an interpreter I will call "Morass" to protect
> the innocent.  An object system was designed on top of Morass's CLOS
> implementation, and Morass's GTk bindings were bound to these custom
> objects to form the GUI layer.

If the Scheme codes are even remotely portable, there are Scheme
implementations that compile to native code and give good performance.

If that's not enough, and at the risk of sounding glib, is there a
reason you aren't using Common Lisp with your CLOS?  A port to CL would
probably be more straightforward than either a port to C and would
result in something much more maintainable than sticking yet another
language in the mix (if I understand what you're trying to do here).
You'd get your performance and likely a vastly better MOP implementation.

Chris.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFZ1l3key5QmfOctcRAj2IAJ0QM9HcQCYUAtIQGy+E0ULwz65vpACeOxVd
jG/lA27PRg6LrRkMAXRgcrw=
=NcWJ
-----END PGP SIGNATURE-----



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]