New submission from Andy Lester <[email protected]>:
Four functions in Objects/unicodectype.c copy values out of lookup tables with
a for loop
int i;
for (i = 0; i < n; i++)
res[i] = _PyUnicode_ExtendedCase[index + i];
instead of a memcpy
memcpy(res, &_PyUnicode_ExtendedCase[index], n * sizeof(Py_UCS4));
My Apple clang version 11.0.0 on my Mac optimizes away the for loop and
generates equivalent code to the memcpy.
gcc 4.8.5 on my Linux box (the newest GCC I have) does not optimize away the
loop.
The four functions are:
_PyUnicode_ToLowerFull
_PyUnicode_ToTitleFull
_PyUnicode_ToUpperFull
_PyUnicode_ToFoldedFull
----------
components: Unicode
messages: 361636
nosy: ezio.melotti, petdance, vstinner
priority: normal
severity: normal
status: open
title: Use memcpy() instead of for() loops in _PyUnicode_To*
type: performance
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue39588>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com