[Patches] [ python-Patches-491936 ] Opt for tok_nextc
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 23 Mar 2002 16:02:58 -0800
Patches item #491936, was opened at 2001-12-12 08:00
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=491936&group_id=5470
Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: David Jacobs (dbj)
Assigned to: Nobody/Anonymous (nobody)
Summary: Opt for tok_nextc
Initial Comment:
tokenizer.c - revision 2.53
I tried to pick a routine that looked like it was
heavily used and optimizations that do not increase
the maintenance burden (I wont feel bad if you reject
it though, I'll keep on trying as long as you don't
consider it a burden :-).
I changed one strcpy to a memcpy because the length
had already been computed.
I also changed the pattern:
a = strchr(b,'\0');
to
a = b + strlen(b);
Which is an idiom I've seen in many other places in
the code so I don't think it makes it harder to
understand and strlen is significantly more efficient
than strchr.
Aloha,
David Jacobs (your pico optimizer :-)
----------------------------------------------------------------------
>Comment By: Neil Schemenauer (nascheme)
Date: 2002-03-24 00:02
Message:
Logged In: YES
user_id=35752
It _seems_ to give about a 2% speedup when running
compileall.py on Lib. That's in the noise. I'm rejecting
this patch. It's just not worth it.
David, don't let this discourage you. Optimizing Python
is hard since all the low hanging fruit has been picked by
other people. I think replacing strncpy with strlcpy might
yield better results. Look at bug 487703.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-03-09 12:00
Message:
Logged In: YES
user_id=21627
Can you report some data about the resulting speedup? I
seriously doubt that this is a significant change; unless
data is forthcoming proving me wrong, I recommend to reject
this patch.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=491936&group_id=5470