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/shared/ClashAvoider.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/shared/ClashAvoider.cpp') diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index f5777e04..a3e54957 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -45,9 +45,9 @@ ClashAvoider::map_path(const Raul::Path& in) unsigned offset = 0; bool has_offset = false; - size_t pos = in.find_last_of("_"); + const size_t pos = in.find_last_of('_'); if (pos != string::npos && pos != (in.length()-1)) { - const std::string trailing = in.substr(in.find_last_of("_")+1); + const std::string trailing = in.substr(pos + 1); has_offset = (sscanf(trailing.c_str(), "%u", &offset) > 0); } @@ -56,7 +56,7 @@ ClashAvoider::map_path(const Raul::Path& in) // Path without _n suffix Path base_path = in; if (has_offset) - base_path = base_path.substr(0, base_path.find_last_of("_")); + base_path = base_path.substr(0, base_path.find_last_of('_')); debug << "BASE: " << base_path << endl; @@ -108,7 +108,7 @@ ClashAvoider::map_path(const Raul::Path& in) std::stringstream ss; ss << base_path << "_" << offset; if (!exists(ss.str())) { - const string name = (base_path.length() > 1) ? base_path.name() : "_"; + const string name = (base_path.length() > 1) ? base_path.symbol() : "_"; string str = ss.str(); InsertRecord i = _symbol_map.insert(make_pair(in, str)); debug << "HIT: offset = " << offset << ", str = " << str << endl; -- cgit v1.2.1