Message 315427 - Python tracker (original) (raw)

Py_MEMCPY() has a special case for small blocks on Windows to work around an ancient performance issue in MSVC. Can we safely assume that recent MSVC properly optimize memcpy()? See #28055

/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks

#if defined(MSC_VER) #define Py_MEMCPY(target, source, length) do {
size_t i
, n_ = (length);
char t_ = (void) (target);
const char s_ = (void) (source);
if (n_ >= 16)
memcpy(t_, s_, n_);
else
for (i_ = 0; i_ < n_; i_++)
t_[i_] = s_[i_];
} while (0) #else #define Py_MEMCPY memcpy #endif