diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-07-29 02:58:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-07-29 03:49:35 +0300 |
commit | 339915a96269ffdd8f48335dda050f4aa071caed (patch) | |
tree | b7723441798a3c0adabd9f1f8a8bd1c154c0f0df /source/blender/python/bmesh | |
parent | 96f08bf9a8e0cfcbbc774c3c00c58d405e3dc55c (diff) |
Optimize PySequence_Fast usage
Access arrays directly, avoiding type-check every time.
Diffstat (limited to 'source/blender/python/bmesh')
-rw-r--r-- | source/blender/python/bmesh/bmesh_py_types.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index 1b2382831b1..e834c839552 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -3766,6 +3766,7 @@ void *BPy_BMElem_PySeq_As_Array_FAST( const char *error_prefix) { BMesh *bm = (r_bm && *r_bm) ? *r_bm : NULL; + PyObject **seq_fast_items = PySequence_Fast_ITEMS(seq_fast); const Py_ssize_t seq_len = PySequence_Fast_GET_SIZE(seq_fast); Py_ssize_t i; @@ -3785,7 +3786,7 @@ void *BPy_BMElem_PySeq_As_Array_FAST( alloc = PyMem_MALLOC(seq_len * sizeof(BPy_BMElem **)); for (i = 0; i < seq_len; i++) { - item = (BPy_BMElem *)PySequence_Fast_GET_ITEM(seq_fast, i); + item = (BPy_BMElem *)seq_fast_items[i]; if (!BPy_BMElem_CheckHType(Py_TYPE(item), htype)) { PyErr_Format(PyExc_TypeError, |