[Python-3000] Google Sprint Ideas
Alexander Belopolsky
alexander.belopolsky at gmail.com
Mon Aug 21 06:43:53 CEST 2006
On Aug 21, 2006, at 12:01 AM, Martin v. Löwis wrote:
> Alexander Belopolsky schrieb:
>> For Py3k, I would like to suggest a buffer protocol modelled
>> after iovec structure that is used by the readv system call.
>> On many systems readv is more efficient than repeated calls
>> to read and I think Py3k will benefit from a direct access to
>> that feature.
>
> -1
What is this -1 for:
a) buffer protocol in Py3k?
b) multisegment buffer protocol?
c) readinto that supports multisegment buffers?
Note that in 2.x buffer protocol is multisegment, but readinto
only supports single-segment buffers.
> It's difficult to use, and I question that there is any
> benefit.
I often deal with the system (kx.com) that represents matrices as
nested lists (1d lists of floats are contiguous). My matrices are
stored on disk as C-style 2d arrays. If fileinto would support
multisegment buffers, I would be able to update in-memory data
from files on disk just with a call to it. Currently I have to do it in
a loop.
> I believe readv is there primarily for symmetry with
> writev and hasn't any sensible uses on its own. writev is
> there so you can add additional headers/trailers around data
> blocks you received from higher layers. I even doubt that
> exposing writev in Python would make a measurable performance
> difference.
I did not suggest to expose anything in Python. AFAIK, the buffer
protocol
is a C API only.
More information about the Python-3000
mailing list