Serhiy Storchaka <storch...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14249>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to