This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients benjamin.peterson, ezio.melotti, jcon, pitrou, serhiy.storchaka, terry.reedy, vstinner
Date 2012-10-20.08:53:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1350723208.01.0.360267188824.issue12805@psf.upfronthosting.co.za>
In-reply-to
Content
In a normal loop we copy into the output buffer for each iteration the element and the separator. As you know, the processor can copy large amounts of data several times more efficiently than byte-for-byte. Therefore, filling the buffer by memset more efficient than calling Py_MEMCPY on each iteration if the buffer size is not too large. Experimenting on different machines I found that Py_MEMCPY is more expensive than sequential filling up to 32 bytes (may be even more, but I chose a conservative estimate). And for empty separator we can just omit copying and filling (it saves several checks per iteration).
History
Date User Action Args
2012-10-20 08:53:28serhiy.storchakasetrecipients: + serhiy.storchaka, terry.reedy, pitrou, vstinner, benjamin.peterson, ezio.melotti, jcon
2012-10-20 08:53:28serhiy.storchakasetmessageid: <1350723208.01.0.360267188824.issue12805@psf.upfronthosting.co.za>
2012-10-20 08:53:27serhiy.storchakalinkissue12805 messages
2012-10-20 08:53:27serhiy.storchakacreate