[pypy-issue] [issue1754] buffer.getslice from raw mem doesn't avoid string copy

Brian Kearns tracker at bugs.pypy.org
Tue May 6 18:33:14 CEST 2014


New submission from Brian Kearns <bdkearns at gmail.com>:

The buffer object returned by objects using raw memory storage like array, mmap, 
etc uses charpsize2str for getslice if step == 1. This means places that use 
buf.getslice (hoping to avoid a string copy) end up with traces like this:

newstr(n)
call(copy_raw_to_string)
strgetitem(x+0)
strgetitem(x+1)
...

Ideally we should use getarrayitem_raw(x+#). If instead of using buf.getslice we 
use an unrolled loop of buf.getitem, traces do use getarrayitem_raw. So, 
something should be done about either the buffer API or JIT optimization to 
ensure common paths are optimal.

----------
messages: 6847
nosy: bdk, pypy-issue
priority: performance bug
status: unread
title: buffer.getslice from raw mem doesn't avoid string copy

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


More information about the pypy-issue mailing list