summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-04-09 21:53:26 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-04-09 21:53:26 (GMT)
commit247109e74dcdde19c491c966496655cb87834981 (patch)
treed1a3f603a2743dfb853b9bf2546d53e65c0b44fc /Objects
parent2a4df127c731330be8455ed8b0640987ec9dae6b (diff)
downloadcpython-247109e74dcdde19c491c966496655cb87834981.zip
cpython-247109e74dcdde19c491c966496655cb87834981.tar.gz
cpython-247109e74dcdde19c491c966496655cb87834981.tar.bz2
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.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c9
1 files changed, 0 insertions, 9 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 6b63157..162221c 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -10375,16 +10375,7 @@ unicode_compare(PyObject *str1, PyObject *str2)
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: