From a645d2b8be4d7d31f6eef1649156b166a01e0c31 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 2 Feb 2010 20:37:50 +0000 Subject: Use Glib string interning (quarks) to make Path/URI operator== very fast. This avoids a ton of string comparison overhead in Ingen when setting various properties (e.g. "ingen:value" was compared several times every time a port value was changed, now this is just a single pointer comparison and the full round trip of a value change does no string comparison at all, but is still property based and RDFey). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2408 a436a847-0d15-0410-975c-d299462d15a1 --- src/gui/PatchTreeWindow.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/gui/PatchTreeWindow.cpp') diff --git a/src/gui/PatchTreeWindow.cpp b/src/gui/PatchTreeWindow.cpp index feb0606c..0ccc7344 100644 --- a/src/gui/PatchTreeWindow.cpp +++ b/src/gui/PatchTreeWindow.cpp @@ -18,6 +18,7 @@ #include "raul/log.hpp" #include "raul/Path.hpp" #include "interface/EngineInterface.hpp" +#include "shared/LV2URIMap.hpp" #include "client/ClientStore.hpp" #include "client/PatchModel.hpp" #include "App.hpp" @@ -93,7 +94,7 @@ PatchTreeWindow::add_patch(SharedPtr pm) if (pm->path().is_root()) { row[_patch_tree_columns.name_col] = App::instance().engine()->uri().str(); } else { - row[_patch_tree_columns.name_col] = pm->path().name(); + row[_patch_tree_columns.name_col] = pm->symbol().c_str(); } row[_patch_tree_columns.enabled_col] = pm->enabled(); row[_patch_tree_columns.patch_model_col] = pm; @@ -105,7 +106,7 @@ PatchTreeWindow::add_patch(SharedPtr pm) if (c != children.end()) { Gtk::TreeModel::iterator iter = _patch_treestore->append(c->children()); Gtk::TreeModel::Row row = *iter; - row[_patch_tree_columns.name_col] = pm->path().name(); + row[_patch_tree_columns.name_col] = pm->symbol().c_str(); row[_patch_tree_columns.enabled_col] = pm->enabled(); row[_patch_tree_columns.patch_model_col] = pm; _patches_treeview->expand_row(_patch_treestore->get_path(iter), true); @@ -191,7 +192,8 @@ PatchTreeWindow::event_patch_enabled_toggled(const Glib::ustring& path_str) assert(pm); if (_enable_signal) - App::instance().engine()->set_property(pm->path(), "ingen:enabled", (bool)!pm->enabled()); + App::instance().engine()->set_property(pm->path(), + App::instance().uris().ingen_enabled, (bool)!pm->enabled()); } @@ -199,8 +201,9 @@ void PatchTreeWindow::patch_property_changed(const URI& key, const Atom& value, SharedPtr patch) { + const LV2URIMap& uris = App::instance().uris(); _enable_signal = false; - if (key.str() == "ingen:enabled" && value.type() == Atom::BOOL) { + if (key == uris.ingen_enabled && value.type() == Atom::BOOL) { Gtk::TreeModel::iterator i = find_patch(_patch_treestore->children(), patch); if (i != _patch_treestore->children().end()) { Gtk::TreeModel::Row row = *i; @@ -223,7 +226,7 @@ PatchTreeWindow::patch_moved(SharedPtr patch) if (i != _patch_treestore->children().end()) { Gtk::TreeModel::Row row = *i; - row[_patch_tree_columns.name_col] = patch->path().name(); + row[_patch_tree_columns.name_col] = patch->symbol().c_str(); } else { LOG(error) << "Unable to find patch " << patch->path() << endl; } -- cgit v1.2.1