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, pitrou, python-dev, serhiy.storchaka, skrah, vstinner
Date 2012-04-05.19:46:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1333655183.56.0.678322448275.issue14249@psf.upfronthosting.co.za>
In-reply-to
Content
What compiler are you using? With gcc 4.4 on 32-bit Linux netbook I get:

                         unpatched  union  shift
utf-16le  " "*10000         129      126    109
utf-16le  "\u263A"*10000    208      203    160
utf-16be  " "*10000         153      147    114
utf-16be  "\u263A"*10000    226      227    167

The difference is that for shift the compiler stores block in register, and for the union the compiler stores block in memory, so that it can get address. May be more recent compilers learned to do this more effectively?

Besides, shifts are more pronounced for CPython code, searching shows very few uses of union in the source code.
History
Date User Action Args
2012-04-05 19:46:23serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, vstinner, benjamin.peterson, skrah, python-dev
2012-04-05 19:46:23serhiy.storchakasetmessageid: <1333655183.56.0.678322448275.issue14249@psf.upfronthosting.co.za>
2012-04-05 19:46:23serhiy.storchakalinkissue14249 messages
2012-04-05 19:46:22serhiy.storchakacreate