Author: Gregor Wegberg <c...@gregorwegberg.com> Branch: gc-incminimark-pinning-improve Changeset: r76529:5fda4d8f0436 Date: 2015-03-23 15:23 +0100 http://bitbucket.org/pypy/pypy/changeset/5fda4d8f0436/
Log: use pinning on input buffer in rzlib This removes one malloc for each compress()/decompress() diff --git a/rpython/rlib/rzlib.py b/rpython/rlib/rzlib.py --- a/rpython/rlib/rzlib.py +++ b/rpython/rlib/rzlib.py @@ -365,10 +365,7 @@ """Common code for compress() and decompress(). """ # Prepare the input buffer for the stream - with lltype.scoped_alloc(rffi.CCHARP.TO, len(data)) as inbuf: - # XXX (groggi) should be possible to improve this with pinning by - # not performing the 'copy_string_to_raw' if non-movable/pinned - copy_string_to_raw(llstr(data), inbuf, 0, len(data)) + with rffi.scoped_nonmovingbuffer(data) as inbuf: stream.c_next_in = rffi.cast(Bytefp, inbuf) rffi.setintfield(stream, 'c_avail_in', len(data)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit