[issue13134] speed up finding of one-character strings

2011-10-13 Thread Martin v . Löwis
Martin v. Löwis added the comment: > I would rather propose to simplify the needle heuristic and only use it > when the lower byte is non-zero. A properly optimized memchr() (as in > the glibc / gcc) is definitely faster than our naïve loop. That would be fine as well. Not sure if a heuristics

[issue13134] speed up finding of one-character strings

2011-10-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > I think the >1 character sizes are overly complex in this patch, and > still memchr isn't typically used for them. So I suggest to simplify > the code and restrict it to 1-byte chars only. I would rather propose to simplify the needle heuristic and only use i

[issue13134] speed up finding of one-character strings

2011-10-13 Thread Martin v . Löwis
Martin v. Löwis added the comment: I think the >1 character sizes are overly complex in this patch, and still memchr isn't typically used for them. So I suggest to simplify the code and restrict it to 1-byte chars only. -- ___ Python tracker

[issue13134] speed up finding of one-character strings

2011-10-11 Thread STINNER Victor
STINNER Victor added the comment: changeset: 72874:bfd3fcfb02f3 user:Victor Stinner date:Tue Oct 11 23:22:22 2011 +0200 files: Objects/stringlib/asciilib.h Objects/stringlib/fastsearch.h Objects/stringlib/stringdefs.h Objects/stringlib/ucs1lib.h Objects/stri description

[issue13134] speed up finding of one-character strings

2011-10-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: I went ahead and committed. -- resolution: -> fixed stage: -> committed/rejected status: open -> closed ___ Python tracker ___ __

[issue13134] speed up finding of one-character strings

2011-10-11 Thread Roundup Robot
Roundup Robot added the comment: New changeset af4a89f4f466 by Antoine Pitrou in branch 'default': Issue #13134: optimize finding single-character strings using memchr http://hg.python.org/cpython/rev/af4a89f4f466 -- nosy: +python-dev ___ Python trac

[issue13134] speed up finding of one-character strings

2011-10-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: > >> Before going further with this, I'd suggest you have a look at your > >> compiler settings. > > > > They are set by the configure script: > > > > gcc -pthread -c -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall > > -Wstrict-prototypes-I. -I./Include

[issue13134] speed up finding of one-character strings

2011-10-09 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: [Posted the reply to the right ticket; see issue13136 for the original post to the wrong ticket] Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > >> Before going further with this, I'd suggest you have a look at your >> compiler settings. >

[issue13134] speed up finding of one-character strings

2011-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: New patch with a couple of tests. -- Added file: http://bugs.python.org/file23350/memchr2.patch ___ Python tracker ___

[issue13134] speed up finding of one-character strings

2011-10-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: With MSVC there seems to be no difference, meaning Windows probably has a naïve memchr() implementation. -- ___ Python tracker ___ ___

[issue13134] speed up finding of one-character strings

2011-10-08 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- keywords: +patch Added file: http://bugs.python.org/file23349/memchr.patch ___ Python tracker ___ ___ P

[issue13134] speed up finding of one-character strings

2011-10-08 Thread Antoine Pitrou
New submission from Antoine Pitrou : In stringlib/fastsearch, instead of using our own loops, we can use memchr() (and, if available, memrchr()) when looking for one-character strings. memchr() is generally quite optimized; on this Linux/glibc machine, I get speedups of 5x-10x: ./python -m ti