• Raymond Hettinger's avatar
    * Beef-up testing of str.__contains__() and str.find(). · 7cbf1bcb
    Raymond Hettinger yazdı
    * Speed-up "x in y" where x has more than one character.
    
    The existing code made excessive calls to the expensive memcmp() function.
    The new code uses memchr() to rapidly find a start point for memcmp().
    In addition to knowing that the first character is a match, the new code
    also checks that the last character is a match.  This significantly reduces
    the incidence of false starts (saving memcmp() calls and making quadratic
    behavior less likely).
    
    Improves the timings on:
        python -m timeit -r7 -s"x='a'*1000" "'ab' in x"
        python -m timeit -r7 -s"x='a'*1000" "'bc' in x"
    
    Once this code has proven itself, then string_find_internal() should refer
    to it rather than running its own version.  Also, something similar may
    apply to unicode objects.
    7cbf1bcb
Adı
Son kayıt (commit)
Son güncelleme
..
.cvsignore Loading commit data...
abstract.c Loading commit data...
boolobject.c Loading commit data...
bufferobject.c Loading commit data...
cellobject.c Loading commit data...
classobject.c Loading commit data...
cobject.c Loading commit data...
complexobject.c Loading commit data...
descrobject.c Loading commit data...
dictnotes.txt Loading commit data...
dictobject.c Loading commit data...
enumobject.c Loading commit data...
fileobject.c Loading commit data...
floatobject.c Loading commit data...
frameobject.c Loading commit data...
funcobject.c Loading commit data...
genobject.c Loading commit data...
intobject.c Loading commit data...
iterobject.c Loading commit data...
listobject.c Loading commit data...
listsort.txt Loading commit data...
longobject.c Loading commit data...
methodobject.c Loading commit data...
moduleobject.c Loading commit data...
object.c Loading commit data...
obmalloc.c Loading commit data...
rangeobject.c Loading commit data...
setobject.c Loading commit data...
sliceobject.c Loading commit data...
stringobject.c Loading commit data...
structseq.c Loading commit data...
tupleobject.c Loading commit data...
typeobject.c Loading commit data...
unicodectype.c Loading commit data...
unicodeobject.c Loading commit data...
unicodetype_db.h Loading commit data...
weakrefobject.c Loading commit data...