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 christian.heimes, gregory.p.smith, jcea, mark.dickinson, pitrou, serhiy.storchaka, skrah, tim.peters
Date 2012-11-11.14:19:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1352643562.72.0.791248491404.issue16427@psf.upfronthosting.co.za>
In-reply-to
Content
Stefan, thank you for the suggestion.  The test showed that, in fact, at least under some x86 there is no performance decrease when using memcpy on nonaligned data.  This is good news.  The code can left simple and even some doubtful potential undefined behavior was removed.

Additional microbenchmarks:

$ ./python -m timeit -n 1 -s "t = memview(b'a' * 10**8)"  "hash(t)"
$ ./python -m timeit -n 1 -s "t = memview(b'a' * 10**8)[1:]"  "hash(t)"
$ ./python -m timeit -n 1 -s "t = memview(b'a' * 10**8)[8:]"  "hash(t)"

               original  patched    speedup

bytes          181 msec  46 msec    3.9x
UCS1           429 msec  46.2 msec  9.3x
UCS2           179 msec  91.9 msec  1.9x
UCS4           183 msec  184 msec   1x
memview()      362 msec  91.7 msec  3.9x
memview()[1:]  362 msec  93.2 msec  3.9x
memview()[8:]  362 msec  92.4 msec  3.9x

I don't know how it will be on other platforms.
History
Date User Action Args
2012-11-11 14:19:22serhiy.storchakasetrecipients: + serhiy.storchaka, tim.peters, gregory.p.smith, jcea, mark.dickinson, pitrou, christian.heimes, skrah
2012-11-11 14:19:22serhiy.storchakasetmessageid: <1352643562.72.0.791248491404.issue16427@psf.upfronthosting.co.za>
2012-11-11 14:19:22serhiy.storchakalinkissue16427 messages
2012-11-11 14:19:22serhiy.storchakacreate