Why is Python so slow ?- revisited.

Eric Hagemann ehagemann at home.com
Sun Jun 18 19:47:52 EDT 2000


Seems to me that you can prove your own assertion.  Simply create another
copy of your code and remove all comments.  I would be quite suprized if you
found speed up -- but see for yourself.

Any reason you are not using more recent versions of python ?

Cheers
Eric


"William Dandreta" <wjdandreta at worldnet.att.net> wrote in message
news:H_c35.12336$Xx5.574993 at bgtnsc06-news.ops.worldnet.att.net...
> Let me preface my remarks with:
>
> --I am using the Python 1.2 binary for DOS with the Python 1.5.2 library
> which causes some problems. I avioded some problems by importing functions
> directly from strop instead of string. Replace is not in strop so I used
the
> one in string but I had to comment out (put an octothorpe at the start of
> each line) the function's descriptive string to get it to work.--
>
> A while ago I posted a message called Why is Python so slow? At that time
> this Python script took 90 minutes to run. By making some relatively minor
> changes, I was able to reduced the time to 6 minutes.
>
> The biggest improvement came (about a factor of 6) when I changed the
> replace(x,y) function in string with
> joinfields(splitfields(x,y),''). Considering that this is exactly what the
> replace function in string does, I was quite surprised at the results.
> Essentially I reduced 3 nested function calls to 2.
>
> The only thing that makes sense to me is that Python is spending 85% of
the
> time processing the comment lines and 15% of the time doing useful work.
> There is a string.pyc so I would have assumed that it would not contain
any
> comments or descriptive strings but apparently that's not true.
>
> I am not very familiar with interpretive languages, Python is the first
one
> I have used, but it seems that comments can cause a serious perfomance hit
> because they have to be processed along with the code.
>
> Bill
>
>





More information about the Python-list mailing list