[Libosinfo] [RFC PATCH 3/5] osinfo_loader: introduce a compiled xpaths cache

Daniel P. Berrange berrange at redhat.com
Tue Jun 3 14:15:40 UTC 2014


On Tue, Jun 03, 2014 at 04:08:10PM +0200, Giuseppe Scrivano wrote:
> @@ -291,7 +314,8 @@ static void osinfo_loader_entity(OsinfoLoader *loader,
>              for (j = 0; langs[j + 1] != NULL; j++) {
>                  xpath = g_strdup_printf("string(./%s[lang('%s')])",
>                                          keys[i].name, langs[j]);
> -                value_str = osinfo_loader_string(xpath, ctxt, err);
> +                comp = osinfo_loader_get_comp_xpath(loader, xpath);
> +                value_str = osinfo_loader_string(comp, ctxt, err);

I think it would be nice to push the call to osinfo_loader_get_comp_xpath
down one level into the osinfo_loader_string() function. That would mean
we only need todo the lookup in a couple of places, instead of every
single caller, while still having the perf benefit.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the Libosinfo mailing list