summaryrefslogtreecommitdiff
path: root/girepository/gitypelib-internal.h
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2013-03-19 11:04:42 -0600
committerColin Walters <walters@verbum.org>2013-04-08 11:22:39 -0400
commit99a7287bb152dc4df299255f42b04ab1766ca6a6 (patch)
tree8ae77e439ae6c8f800b3c5083b374d3599a92c01 /girepository/gitypelib-internal.h
parent60fd253d795e312eae91c9ed32930e3304170176 (diff)
downloadgobject-introspection-99a7287bb152dc4df299255f42b04ab1766ca6a6.tar.gz
Optimize g_irepository_find_by_gtype
When g_irepository_find_by_gtype() doesn't succeed on a simple prefix match (the current 'fastpass' mechanism), it ends up taking a considerable amount of CPU time, traversing the contents of all typelibs. I imagine that the reasons to have the exhaustive search fallback are not as strong as they used to be. For example, the case mentioned (Clutter including Cogl) no longer seems to be true. Also, typelibs (as generated by g-ir-scanner) now provide comma-separated C prefix info for cases when the typelib includes introspection info for multiple prefixes. For example, the Sugar typelib has a c_prefix string of Sugar,EggSM,Gsm,Acme. So I imagine there are not many remaining justified cases where the exhaustive search is needed. With that in mind, I found two ways to optimize this function: 1. Support comma-separated C prefixes 2. Don't bother with an exhaustive search if we did find a typelib claiming support for the prefix. For example, if we're looking for GdkDeviceManagerXI2 (currently non-introspectable) and we already found typelib files providing the 'Gdk' prefix that didn't offer this, lets not bother with the exhaustive search, we aren't going to find anything.
Diffstat (limited to 'girepository/gitypelib-internal.h')
-rw-r--r--girepository/gitypelib-internal.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/girepository/gitypelib-internal.h b/girepository/gitypelib-internal.h
index 04662b4a..ac71008d 100644
--- a/girepository/gitypelib-internal.h
+++ b/girepository/gitypelib-internal.h
@@ -1126,13 +1126,15 @@ DirEntry *g_typelib_get_dir_entry (GITypelib *typelib,
DirEntry *g_typelib_get_dir_entry_by_name (GITypelib *typelib,
const char *name);
-DirEntry *g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
- gboolean fastpass,
- GType gtype);
+DirEntry *g_typelib_get_dir_entry_by_gtype_name (GITypelib *typelib,
+ const gchar *gtype_name);
DirEntry *g_typelib_get_dir_entry_by_error_domain (GITypelib *typelib,
GQuark error_domain);
+gboolean g_typelib_matches_gtype_name_prefix (GITypelib *typelib,
+ const gchar *gtype_name);
+
void g_typelib_check_sanity (void);
#define g_typelib_get_string(typelib,offset) ((const gchar*)&(typelib->data)[(offset)])