[pypy-commit] pypy default: cache the _ffiargtype; this saves a dict lookup in hot loops

antocuni noreply at buildbot.pypy.org
Fri Sep 2 16:39:05 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r47027:ba4f25da7080
Date: 2011-09-02 16:38 +0200
http://bitbucket.org/pypy/pypy/changeset/ba4f25da7080/

Log:	cache the _ffiargtype; this saves a dict lookup in hot loops

diff --git a/lib_pypy/_ctypes/basics.py b/lib_pypy/_ctypes/basics.py
--- a/lib_pypy/_ctypes/basics.py
+++ b/lib_pypy/_ctypes/basics.py
@@ -54,7 +54,8 @@
     def get_ffi_argtype(self):
         if self._ffiargtype:
             return self._ffiargtype
-        return _shape_to_ffi_type(self._ffiargshape)
+        self._ffiargtype = _shape_to_ffi_type(self._ffiargshape)
+        return self._ffiargtype
 
     def _CData_output(self, resbuffer, base=None, index=-1):
         #assert isinstance(resbuffer, _rawffi.ArrayInstance)


More information about the pypy-commit mailing list