[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27025] trunk/blender/source/blender/ makesrna/intern/rna_access.c: faster function lookups, quick test through python cuts a quater the time off.

Campbell Barton ideasman42 at gmail.com
Fri Feb 19 17:31:04 CET 2010


Revision: 27025
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27025
Author:   campbellbarton
Date:     2010-02-19 17:31:03 +0100 (Fri, 19 Feb 2010)

Log Message:
-----------
faster function lookups, quick test through python cuts a quater the time off.
was doing an extra lookup for the functions property, as well as using the property iterator.
(every button & menu item draws does one of these for every redraw).

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/rna_access.c

Modified: trunk/blender/source/blender/makesrna/intern/rna_access.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_access.c	2010-02-19 15:34:26 UTC (rev 27024)
+++ trunk/blender/source/blender/makesrna/intern/rna_access.c	2010-02-19 16:31:03 UTC (rev 27025)
@@ -574,6 +574,19 @@
 
 FunctionRNA *RNA_struct_find_function(PointerRNA *ptr, const char *identifier)
 {
+#if 1
+	FunctionRNA *func;
+	StructRNA *type;
+	for(type= ptr->type; type; type= type->base) {
+		for(func= type->functions.first; func; func= func->cont.next) {
+			if(strcmp(func->identifier, identifier)==0)
+				return func;
+		}
+	}
+	return NULL;
+
+	/* funcitonal but slow */
+#else
 	PointerRNA tptr;
 	PropertyRNA *iterprop;
 	FunctionRNA *func;
@@ -592,6 +605,7 @@
 	RNA_PROP_END;
 
 	return func;
+#endif
 }
 
 const struct ListBase *RNA_struct_defined_functions(StructRNA *srna)





More information about the Bf-blender-cvs mailing list