sgmllib too slow

Stuart D. Gathman stuart at bmsi.com
Wed May 8 13:57:13 EDT 2002


On Wed, 08 May 2002 02:08:04 -0400, Alex Martelli wrote:

> Martin v. Loewis wrote:
> 
>> "Stuart D. Gathman" <stuart at bmsi.com> writes:
>> 
>>> What is the recommended way to make distutils override a standard
>>> python package with a drop-in replacement such this?
>> 
>> The recommended way is not to attempt overriding standard Python
>> packages. Name them differently, instead.
> 
> How would it help in the case in point?  Say the new sgmllib has
> identical functionality to the one distributed with Python but is 10
> times faster.  Why _shouldn't_ I be able to install it instead of the

 
Well, I seem to have sparked a controversy!  I too was leary about
permanently replacing the default versions - that is why I put the new
packages in site-packages.

However, the ideal solution is to place the drop-in replactements in
their own directory - example /usr/local/lib/python2.1/turbo, then put
this in PYTHONPATH:

$ export PYTHONPATH=/usr/local/lib/python2.1/turbo
$ python test.py

This adds the turbo modules to the front of the module path.  This allows
the tests to be run with and without the new C code, allowing me to check

a) is it actually faster?
b) does it still work?

My initial results are:

a) Yes, cuts total application time by more than half.
b) No, several things are incompatible in the C version.  A lot more work
needs to be done before it is truly a "drop-in".

Since I *have* to improve the performance to stay with Python, I plan to
both tweak my code to work with sgmlop, and try to fix some of the
problems with sgmlop.

-- 
Stuart D. Gathman <stuart at bmsi.com>
Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flamis acribus addictis" - Mozart background
song for the Microsoft "Where do you want to go from here?" commercial.



More information about the Python-list mailing list