[pypy-svn] r75756 - pypy/trunk/pypy/rpython/lltypesystem
fijal at codespeak.net
fijal at codespeak.net
Fri Jul 2 12:52:55 CEST 2010
Author: fijal
Date: Fri Jul 2 12:52:54 2010
New Revision: 75756
Modified:
pypy/trunk/pypy/rpython/lltypesystem/rffi.py
Log:
Disable an attempt to allocate a nonmoving buffer. This speeds up twisted's
tests by a considerable margin. Reason - in case we however do copy the buffer,
we end up allocating new and new buffers, collecting every now and then instead
of reusing freelists of C.
Modified: pypy/trunk/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/trunk/pypy/rpython/lltypesystem/rffi.py (original)
+++ pypy/trunk/pypy/rpython/lltypesystem/rffi.py Fri Jul 2 12:52:54 2010
@@ -642,16 +642,8 @@
allows for the process to be performed without an extra copy.
Make sure to call keep_buffer_alive_until_here on the returned values.
"""
- str_chars_offset = (offsetof(STRTYPE, 'chars') + \
- itemoffsetof(STRTYPE.chars, 0))
- gc_buf = rgc.malloc_nonmovable(STRTYPE, count)
- if gc_buf:
- realbuf = cast_ptr_to_adr(gc_buf) + str_chars_offset
- raw_buf = cast(TYPEP, realbuf)
- return raw_buf, gc_buf
- else:
- raw_buf = lltype.malloc(TYPEP.TO, count, flavor='raw')
- return raw_buf, lltype.nullptr(STRTYPE)
+ raw_buf = lltype.malloc(TYPEP.TO, count, flavor='raw')
+ return raw_buf, lltype.nullptr(STRTYPE)
alloc_buffer._always_inline_ = True # to get rid of the returned tuple
# (char*, str, int, int) -> None
More information about the Pypy-commit
mailing list