Why is Python so slow?
Peter Schneider-Kamp
petersc at stud.ntnu.no
Sun Jun 18 17:14:11 EDT 2000
More information about the Python-list mailing list
Sun Jun 18 17:14:11 EDT 2000
- Previous message (by thread): Why is Python so slow?
- Next message (by thread): win32all-132 available
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
William Dandreta wrote: > > 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 Thanks, but I don't deserve that title ;) > 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. In my Python version (post 1.6a2 CVS) the joinfields/splitfields solution caused double the number of function calls (naturally...) and ran almost half as fast the replace version. BTW: You probably meant: replace(x,y,z) = joinfields(splitfields(x,y),z) Bye Peter -- Peter Schneider-Kamp ++47-7388-7331 Herman Krags veg 51-11 mailto:peter at schneider-kamp.de N-7050 Trondheim http://schneider-kamp.de
- Previous message (by thread): Why is Python so slow?
- Next message (by thread): win32all-132 available
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list