New submission from Brian Kearns <[email protected]>:

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 <[email protected]>
<https://bugs.pypy.org/issue1754>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to