[Python-bugs-list] [ python-Bugs-780807 ] time.strptime() 1,200 times slower in python2.3

SourceForge.net noreply@sourceforge.net
Tue, 05 Aug 2003 06:46:47 -0700


Bugs item #780807, was opened at 2003-07-31 12:17
Message generated for change (Comment added) made by drmalte
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=780807&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 4
Submitted By: Malte John (drmalte)
Assigned to: Brett Cannon (bcannon)
Summary: time.strptime() 1,200 times slower in python2.3

Initial Comment:
time.strptime() ist about 1,200 (onethousand and
twohundred) times slower in 2.3 than in 2.2! (1m:48.45s
vs. 0.09s) This is caused by the pure python
implementation. 

Fix:
I simply repaced the function time_strptime(PyObject
*self, PyObject *args) from
Python-2.3/Modules/timemodule.c with the function from
python 2.2. 
Maybe 'configure' should check for existence of the
strptime() function on the target system and use it, if
available?

Regards,
Malte

----------------------------------------------------------------------

>Comment By: Malte John (drmalte)
Date: 2003-08-05 13:46

Message:
Logged In: YES 
user_id=834648

Hi,
I pulled out the brand new version 1.24 wih reintroduced
caching.
Speedup is is about 400 times :) so it is only three times
slower than the system strptime in my testloop ( ~6000
lines/s vs. 16200 lines/s )

Thanks a lot!
Malte


----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-08-04 16:36

Message:
Logged In: YES 
user_id=357491

Raymond is talking about version 1.21 .  That was the last version 
with caching.

I realize that strptime is no longer a speed demon for those 
platforms that have a C version, but now everyone has a version 
that is consistent which I think is worth the slowdown.

But there still might be hope for a speedup.  There is a chance 
that I will be allowed to reintroduce the caching code for 2.3.1 .  If 
that happens performance will pick up significantly.  If not you will 
have to wait until 2.4 .

----------------------------------------------------------------------

Comment By: Malte John (drmalte)
Date: 2003-08-03 17:45

Message:
Logged In: YES 
user_id=834648

Thanks for the hint!
I pulled out _strptimy.py Version 1.23 which is identical to
the version in the Python-2.3.tgz I used. :(
Here is the output of tar -ztvf 
...
-rw-rw-r-- barry/barry   20933 2003-07-24 22:02:28
Python-2.3/Lib/_strptime.py
...

Regards
Malte

----------------------------------------------------------------------

Comment By: Raymond Hettinger (rhettinger)
Date: 2003-08-02 08:53

Message:
Logged In: YES 
user_id=80475

It would be interesting for you to pull down the CVS version 
from two weeks ago and re-run your timings.  The caching 
code was removed at the end because it was a temporary 
suspect on a bug-hunt just days before the release.

Note, the whole purpose of the pure python version was to 
avoid the non-portable differences between strptime() 
implementations on various target systems.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=780807&group_id=5470