Josiah Carlson <[EMAIL PROTECTED]> added the comment:

Sadly, this isn't quite as easy as it would seem.  The O(1) memory
overhead version of this requires 2n reads and 2n writes, but does both
reads and writes at two memory locations at a time, which may have
nontrivial performance implications.

The simple version that copies out the small part of the shift into a
temporary buffer, doing a memcpy/memmov internally, then copying the
small data back is likely to have much better performance (worst-case
1.5n reads and 1.5n writes.

Offering this ability in the momoryview object would be very
interesting, though I'm not sure that the memoryview object is able to
offer a multi-segment buffer interface where the segments are not the
same length (this could be hacked by having a single pointer per byte,
but at that point we may as well perform a copy).

----------
nosy: +josiahcarlson

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue3489>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to