[Python-checkins] cpython: Issue #17615: On Windows (VS2010), Performances of wmemcmp() to compare Unicode
victor.stinner
python-checkins at python.org
Tue Apr 9 23:53:41 CEST 2013
http://hg.python.org/cpython/rev/b3168643677b
changeset: 83228:b3168643677b
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Apr 09 23:53:26 2013 +0200
summary:
Issue #17615: On Windows (VS2010), Performances of wmemcmp() to compare Unicode
strings are not convincing. For UCS2 (16-bit wchar_t type), use a dummy loop
instead of wmemcmp(). The dummy loop is as fast, or a little bit faster.
wchar_t is only 16-bit long on Windows. wmemcmp() is still used for 32-bit
wchar_t.
files:
Objects/unicodeobject.c | 9 ---------
PC/pyconfig.h | 3 ---
2 files changed, 0 insertions(+), 12 deletions(-)
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10375,16 +10375,7 @@
break;
case PyUnicode_2BYTE_KIND:
{
-#if defined(HAVE_WMEMCMP) && SIZEOF_WCHAR_T == 2
- int cmp = wmemcmp((wchar_t *)data1, (wchar_t *)data2, len);
- /* normalize result of wmemcmp() into the range [-1; 1] */
- if (cmp < 0)
- return -1;
- if (cmp > 0)
- return 1;
-#else
COMPARE(Py_UCS2, Py_UCS2);
-#endif
break;
}
case PyUnicode_4BYTE_KIND:
diff --git a/PC/pyconfig.h b/PC/pyconfig.h
--- a/PC/pyconfig.h
+++ b/PC/pyconfig.h
@@ -645,9 +645,6 @@
#define HAVE_WCSXFRM 1
#endif
-/* Define to 1 if you have the `wmemcmp' function. */
-#define HAVE_WMEMCMP 1
-
/* Define if the zlib library has inflateCopy */
#define HAVE_ZLIB_COPY 1
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list