mirror of
https://github.com/jezhiggins/arabica
synced 2024-11-17 07:48:50 +01:00
Use boost::unordered_set for the String pool rather than my rather rubbish std::list. Much quicker. Patch provided by Gunther Laure
This commit is contained in:
parent
97ecf9040b
commit
2a9d8ca748
1 changed files with 3 additions and 7 deletions
|
@ -17,8 +17,8 @@
|
||||||
#include <DOM/Simple/NodeImpl.hpp>
|
#include <DOM/Simple/NodeImpl.hpp>
|
||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <list>
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <boost/unordered_set.hpp>
|
||||||
|
|
||||||
namespace Arabica
|
namespace Arabica
|
||||||
{
|
{
|
||||||
|
@ -506,11 +506,7 @@ class DocumentImpl : public DOM::Document_impl<stringT, string_adaptorT>,
|
||||||
|
|
||||||
stringT const* stringPool(const stringT& str) const
|
stringT const* stringPool(const stringT& str) const
|
||||||
{
|
{
|
||||||
typename std::list<stringT>::const_iterator i = std::find(stringPool_.begin(), stringPool_.end(), str);
|
return &(*stringPool_.insert(str).first);
|
||||||
if(i != stringPool_.end())
|
|
||||||
return &(*i);
|
|
||||||
stringPool_.push_back(str);
|
|
||||||
return &(stringPool_.back());
|
|
||||||
} // stringPool
|
} // stringPool
|
||||||
|
|
||||||
const stringT& empty_string() const { return empty_; }
|
const stringT& empty_string() const { return empty_; }
|
||||||
|
@ -537,7 +533,7 @@ class DocumentImpl : public DOM::Document_impl<stringT, string_adaptorT>,
|
||||||
|
|
||||||
mutable std::set<NodeImplT*> orphans_;
|
mutable std::set<NodeImplT*> orphans_;
|
||||||
std::set<AttrImplT*> idNodes_;
|
std::set<AttrImplT*> idNodes_;
|
||||||
mutable std::list<stringT> stringPool_;
|
mutable boost::unordered_set<stringT> stringPool_;
|
||||||
const stringT empty_;
|
const stringT empty_;
|
||||||
}; // class DocumentImpl
|
}; // class DocumentImpl
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue