[issue39588] Use memcpy() instead of for() loops in _PyUnicode_To*

2020-02-08 Thread Andy Lester
Andy Lester added the comment: Thanks for replying. I figured that might be the case, which is why I made a ticket before bothering with a pull request. I've also seen this kind of thing around: i = ctx->pattern[0]; Py_ssize_t groupref = i+i; instead of

[issue39588] Use memcpy() instead of for() loops in _PyUnicode_To*

2020-02-08 Thread Raymond Hettinger
Raymond Hettinger added the comment: In the past, we've also gotten some gains by replacing memcpy() with for-loops. These kinds of optimization choices are best left to the compiler. -- nosy: +rhettinger resolution: -> rejected stage: -> resolved status: open -> closed

[issue39588] Use memcpy() instead of for() loops in _PyUnicode_To*

2020-02-08 Thread Andy Lester
New submission from Andy Lester : 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,