[issue17628] str==str: compare the first character before calling memcmp()

2015-03-18 Thread STINNER Victor
STINNER Victor added the comment: The benefit of any change is unclear. I'm not more interested to work on such optimization, so I just close the issue. -- resolution: -> out of date status: open -> closed ___ Python tracker

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-31 Thread Martin Mokrejs
Martin Mokrejs added the comment: Regarding benchmarking and code performance inspection, maybe you want to try on your linux box: perf top perf stat /usr/bin/python mytest.py http://perf.wiki.kernel.org/ -- nosy: +mmokrejs ___ Python tracker

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-16 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, there are two distinct issues. As everyone has noted here, accessing memory in non-sequential order is a performance killer. The other issue (the one I was working on) is that early-out first-char or last-char tests are a waste (almost never executed

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-15 Thread Christian Heimes
Christian Heimes added the comment: It's also bad for memory read performance if the string is rather long. The memory controller performs best when code reads memory sequential. The talk http://www.youtube.com/watch?v=MC1EKLQ2Wmg about mythbusting modern hardware sums it up real nice. --

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-15 Thread STINNER Victor
STINNER Victor added the comment: In issue #18719, Raymond modified Python 2.7, but he didn't touch the following macro: #define Py_UNICODE_MATCH(string, offset, substring) \ ((*((string)->str + (offset)) == *((substring)->str)) && \ ((*((string)->str + (offset) + (substring)->length-1)

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-15 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Perhaps it worth manually inline unicode_eq() in these tight inner loops. Then we can move "PyUnicode_GET_LENGTH(a) * PyUnicode_KIND(a)" out of the loop. -- ___ Python tracker _

[issue17628] str==str: compare the first character before calling memcmp()

2013-08-14 Thread Raymond Hettinger
Raymond Hettinger added the comment: The dont-compare-first-last patch looks about right. The "if (len == 0) return 1;" shortcut perhaps should be taken out. It makes the common case pay (if only slightly) for the rare case (which of course, never gets predicted). This whole code block gets

[issue17628] str==str: compare the first character before calling memcmp()

2013-07-05 Thread Christian Heimes
Changes by Christian Heimes : -- nosy: +christian.heimes ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue17628] str==str: compare the first character before calling memcmp()

2013-06-04 Thread STINNER Victor
Changes by STINNER Victor : -- title: str==str: compare the first and last character before calling memcmp() -> str==str: compare the first character before calling memcmp() ___ Python tracker