Why is Python so slow?

William Dandreta wjdandreta at worldnet.att.net
Sun Jun 18 15:42:04 EDT 2000


I posted a message a while ago about a Python script I wrote that took 90
mins to run when a similar job in C++ took only 2 mins.

With help from some experts in this news group, most notably, Peter
Schneider-Kamp, I was able to reduce the time to 37 mins.

Today I was looking at the script and I noticed that the only string
function I was using that was not in strop was replace. I took a look at it
and found:

replace(x,y) = joinfields(splitfields(x,y),'')

When I replaced, replace with the joinfields(splitfields()) in strop, much
to my surprise, the time for the job dropped to 6 minutes.

I am posting this because I thought this info might be useful to others.

Bill





More information about the Python-list mailing list