[pypy-issue] [issue869] Implement ctypes.<type>.from_buffer method

Michael Schurter tracker at bugs.pypy.org
Wed Dec 14 18:14:40 CET 2011


Michael Schurter <m at schmichael.com> added the comment:

arigo: I was able to switch from .from_buffer to .from_address[1] by not using
the stdlib's mmap module and instead creating my own wrapper[2]. So this feature
isn't critical for my use case at the moment.

I have no idea how buffers are implemented, but if they contain a pointer to a
contiguous memory area .from_buffer could be implemented on top of .from_address.

Unfortunately mmstats also dynamically creates ctypes.Structures to ease
creation of data structures in shared memory and agaynor informed me Structures
aren't optimized yet. Indeed the performance impact of mmstats, while minimal,
seems to be the same on CPython 2.7 and PyPy 1.7. Removing the ctype.Structures
is possible and might have other benefits, but as it requires even more fine
grained pointer tracking I'm slow to pursue that route.


tl;dr - Thanks for looking into this bug, but at this point I'd rather have
better ctypes.Structure performance than .from_buffer implemented.


[1]
https://github.com/schmichael/mmstats/commit/59d4af44cd9f33ce8fbc5803649f37e2d653141a#L0L101

[2] https://github.com/schmichael/mmstats/blob/master/mmstats_compat.py#L24

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue869>
________________________________________


More information about the pypy-issue mailing list