summaryrefslogtreecommitdiff
path: root/giscanner/sourcescanner.h
diff options
context:
space:
mode:
authorDieter Verfaillie <dieterv@optionexplicit.be>2013-10-17 17:26:10 +0200
committerColin Walters <walters@verbum.org>2013-10-17 15:03:26 -0400
commit65a0fa4c4e005047af7ec029c733bed4bd80292f (patch)
treefb76a7fec121c54827b0eaef946d25e1732464af /giscanner/sourcescanner.h
parent69d2fe30289795b3daf099a5f84ff9216dc6ed44 (diff)
downloadgobject-introspection-65a0fa4c4e005047af7ec029c733bed4bd80292f.tar.gz
giscanner: speed up SourceScanner().parse_files()
Was looking around a bit and noticed about 2/3 of g-ir-scanner time is spent in SourceScanner().parse_files(). Some profiling quickly shows most of that 2/3 is used by gi_source_scanner_add_symbol() where it creates a whole bunch of GFile instances just to compare paths and throw them away again. With this a scanner instance now maintains a hash table of GFile instances instead of a list of file names, so comparing those paths can be reduced to a fast g_hash_table_contains() call. This makes "g-ir-scanner <whole_bunch_of_options> --output Gtk-3.0.gir" complete in about 10 seconds on my box instead of about 30 seconds (both best of 3 runs). https://bugzilla.gnome.org/show_bug.cgi?id=710320
Diffstat (limited to 'giscanner/sourcescanner.h')
-rw-r--r--giscanner/sourcescanner.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/giscanner/sourcescanner.h b/giscanner/sourcescanner.h
index f67ae6bd..2db9bdf6 100644
--- a/giscanner/sourcescanner.h
+++ b/giscanner/sourcescanner.h
@@ -25,6 +25,7 @@
#include <glib.h>
#include <stdio.h>
+#include <gio/gio.h>
G_BEGIN_DECLS
@@ -105,12 +106,12 @@ struct _GISourceComment
struct _GISourceScanner
{
- char *current_filename;
+ GFile *current_file;
gboolean macro_scan;
gboolean private; /* set by gtk-doc comment <private>/<public> */
gboolean flags; /* set by gtk-doc comment <flags> */
GSList *symbols;
- GList *filenames;
+ GHashTable *files;
GSList *comments; /* _GIComment */
GHashTable *typedef_table;
GHashTable *struct_or_union_or_enum_table;
@@ -158,7 +159,7 @@ GSList * gi_source_scanner_get_symbols (GISourceScanner *scanne
GSList * gi_source_scanner_get_comments (GISourceScanner *scanner);
void gi_source_scanner_free (GISourceScanner *scanner);
-GISourceSymbol * gi_source_symbol_new (GISourceSymbolType type, const gchar *filename, int line);
+GISourceSymbol * gi_source_symbol_new (GISourceSymbolType type, GFile *file, int line);
gboolean gi_source_symbol_get_const_boolean (GISourceSymbol *symbol);
GISourceSymbol * gi_source_symbol_ref (GISourceSymbol *symbol);
void gi_source_symbol_unref (GISourceSymbol *symbol);