Author: Antonio Cuni <[email protected]>
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)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit