Christian Heimes added the comment:

Am 28.10.2013 16:59, schrieb Charles-François Natali:
> Well, unaligned memory access is usually slower on all architectures :-)
> Also, I think some ARM architectures don't support unaligned access, so
> it's not really a thing of the past...

On modern computers it's either not slower or just a tiny bit slower.
http://lemire.me/blog/archives/2012/05/31/data-alignment-for-speed-myth-or-reality/

Python's str and bytes datatype are always aligned properly. The
majority of bytearray and memoryview instances are aligned, too.
Unaligned memory access is rare case for most applications. About 50% of
strings have less than 8 bytes (!), 90% have less than 16 bytes. For the
Python's test suite the numbers are even smaller: ~45% <=5 bytes, ~90%
<=12 bytes.

You might see a 10% slowdown for very long and unaligned byte arrays on
some older CPUs. I think we can safely ignore the special case. Any
special case for unaligned memory will introduce additional overhead
that *will* slow down the common path.

Oh, and ARM has unaligned memory access:
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0360f/CDFEJCBH.html

----------

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

Reply via email to