[pypy-commit] pypy gc-incminimark-pinning-improve: use pinning on input buffer in rzlib
groggi
noreply at buildbot.pypy.org
Mon Mar 23 15:24:09 CET 2015
Author: Gregor Wegberg <code at 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))
More information about the pypy-commit
mailing list