use ghash for operator and menu types, was doing string lookup in the operator list (containing over 1000 items) for each button draw.

gives small speedup for UI drawing and overall startup time.
This commit is contained in:
2011-08-11 06:06:17 +00:00
parent 0fac849d44
commit a7663cc377
10 changed files with 110 additions and 61 deletions

View File

@@ -52,6 +52,9 @@
#include "WM_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_ghash.h"
#include "BKE_report.h"
#include "BKE_context.h"
@@ -359,15 +362,18 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args)
static PyObject *pyop_dir(PyObject *UNUSED(self))
{
GHashIterator *iter= WM_operatortype_iter();
PyObject *list= PyList_New(0), *name;
wmOperatorType *ot;
for(ot= WM_operatortype_first(); ot; ot= ot->next) {
for( ; !BLI_ghashIterator_isDone(iter); BLI_ghashIterator_step(iter)) {
wmOperatorType *ot= BLI_ghashIterator_getValue(iter);
name= PyUnicode_FromString(ot->idname);
PyList_Append(list, name);
Py_DECREF(name);
}
BLI_ghashIterator_free(iter);
return list;
}