experimental session-save speedup

property order is not important,
unordered_map lookup and insertion is O(1)
This commit is contained in:
Robin Gareus
2016-04-08 20:32:49 +02:00
parent 6dd5d6df71
commit d1dcedaccf
2 changed files with 5 additions and 5 deletions

View File

@@ -29,7 +29,7 @@
#include <string>
#include <list>
#include <map>
#include <unordered_map>
#include <cstdio>
#include <cstdarg>
@@ -50,7 +50,7 @@ typedef XMLNodeList::const_iterator XMLNodeConstIterator;
typedef std::list<XMLProperty*> XMLPropertyList;
typedef XMLPropertyList::iterator XMLPropertyIterator;
typedef XMLPropertyList::const_iterator XMLPropertyConstIterator;
typedef std::map<std::string, XMLProperty*> XMLPropertyMap;
typedef std::unordered_map<std::string, XMLProperty*> XMLPropertyMap;
class LIBPBD_API XMLTree {
public:

View File

@@ -408,7 +408,7 @@ XMLProperty*
XMLNode::property(const char* n)
{
string ns(n);
map<string,XMLProperty*>::iterator iter;
unordered_map<string,XMLProperty*>::iterator iter;
if ((iter = _propmap.find(ns)) != _propmap.end()) {
return iter->second;
@@ -420,7 +420,7 @@ XMLNode::property(const char* n)
XMLProperty*
XMLNode::property(const string& ns)
{
map<string,XMLProperty*>::iterator iter;
unordered_map<string,XMLProperty*>::iterator iter;
if ((iter = _propmap.find(ns)) != _propmap.end()) {
return iter->second;
@@ -433,7 +433,7 @@ XMLProperty*
XMLNode::add_property(const char* n, const string& v)
{
string ns(n);
map<string,XMLProperty*>::iterator iter;
unordered_map<string,XMLProperty*>::iterator iter;
if ((iter = _propmap.find(ns)) != _propmap.end()) {
iter->second->set_value (v);