summaryrefslogtreecommitdiffstats
path: root/Lib/sunau.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-02-20 04:07:08 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-02-20 04:07:08 (GMT)
commit7cbf1bcb3e55c61617352ec1b20176603dacbafe (patch)
treefa39e30071d423e8c3de3574de4ac11f5998887d /Lib/sunau.py
parent54c273c703957e37100900b3e8a25f94c4c17003 (diff)
downloadcpython-7cbf1bcb3e55c61617352ec1b20176603dacbafe.zip
cpython-7cbf1bcb3e55c61617352ec1b20176603dacbafe.tar.gz
cpython-7cbf1bcb3e55c61617352ec1b20176603dacbafe.tar.bz2
* Beef-up testing of str.__contains__() and str.find().
* 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.
Diffstat (limited to 'Lib/sunau.py')
0 files changed, 0 insertions, 0 deletions