[gnome-software] appstream: Use XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE everywhere
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] appstream: Use XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE everywhere
- Date: Fri, 5 Jun 2020 10:45:20 +0000 (UTC)
commit 7a6ee72728171fec651827be361a57e3629050e0
Author: Philip Withnall <withnall endlessm com>
Date: Thu Jun 4 12:39:12 2020 +0100
appstream: Use XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE everywhere
This saves 1.8MB of heap memory of `XbNode` instances which were rarely
used (they were inserted into the cache, hit a few times, and then the
processing code moved on and they mostly weren’t accessed again). It
also saves the associated locking overhead.
This depends on the new flag being introduced in libxmlb 0.2.0 — see
https://github.com/hughsie/libxmlb/pull/57.
The use of this flag means gnome-software can’t use
`xb_node_{get,set}_data()`, but it didn’t do anyway.
Signed-off-by: Philip Withnall <withnall endlessm com>
plugins/core/gs-plugin-appstream.c | 3 +++
plugins/external-appstream/gs-install-appstream.c | 6 +++++-
plugins/flatpak/gs-flatpak.c | 9 +++++++++
3 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/plugins/core/gs-plugin-appstream.c b/plugins/core/gs-plugin-appstream.c
index d58d6320..96d189ec 100644
--- a/plugins/core/gs-plugin-appstream.c
+++ b/plugins/core/gs-plugin-appstream.c
@@ -548,6 +548,9 @@ gs_plugin_appstream_check_silo (GsPlugin *plugin,
g_debug ("ensuring %s", blobfn);
priv->silo = xb_builder_ensure (builder, file,
XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID |
+#if LIBXMLB_CHECK_VERSION(0, 2, 0)
+ XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE |
+#endif
XB_BUILDER_COMPILE_FLAG_SINGLE_LANG,
NULL, error);
if (priv->silo == NULL)
diff --git a/plugins/external-appstream/gs-install-appstream.c
b/plugins/external-appstream/gs-install-appstream.c
index 560e528c..0273808a 100644
--- a/plugins/external-appstream/gs-install-appstream.c
+++ b/plugins/external-appstream/gs-install-appstream.c
@@ -93,7 +93,11 @@ gs_install_appstream_check_content_type (GFile *file, GError **error)
return FALSE;
}
xb_builder_import_source (builder, source);
- silo = xb_builder_compile (builder, XB_BUILDER_COMPILE_FLAG_NONE,
+ silo = xb_builder_compile (builder,
+#if LIBXMLB_CHECK_VERSION(0, 2, 0)
+ XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE |
+#endif
+ XB_BUILDER_COMPILE_FLAG_NONE,
NULL, &error_local);
if (silo == NULL) {
g_set_error (error,
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 020f821e..81792873 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -763,6 +763,9 @@ gs_flatpak_rescan_appstream_store (GsFlatpak *self,
g_debug ("ensuring %s", blobfn);
self->silo = xb_builder_ensure (builder, file,
XB_BUILDER_COMPILE_FLAG_IGNORE_INVALID |
+#if LIBXMLB_CHECK_VERSION(0, 2, 0)
+ XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE |
+#endif
XB_BUILDER_COMPILE_FLAG_SINGLE_LANG,
NULL, error);
if (self->silo == NULL)
@@ -2546,6 +2549,9 @@ gs_flatpak_file_to_app_bundle (GsFlatpak *self,
return NULL;
xb_builder_import_source (builder, source);
silo = xb_builder_compile (builder,
+#if LIBXMLB_CHECK_VERSION(0, 2, 0)
+ XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE |
+#endif
XB_BUILDER_COMPILE_FLAG_SINGLE_LANG,
cancellable,
error);
@@ -2793,6 +2799,9 @@ gs_flatpak_file_to_app_ref (GsFlatpak *self,
/* build silo */
silo = xb_builder_compile (builder,
+#if LIBXMLB_CHECK_VERSION(0, 2, 0)
+ XB_BUILDER_COMPILE_FLAG_NO_NODE_CACHE |
+#endif
XB_BUILDER_COMPILE_FLAG_SINGLE_LANG,
cancellable,
error);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]