ECL peaceman well: replace std::unordered_map by std::map

say 99.95% of all time: premature optimization is the root of all
evil.

in this case it turned out that iterating over a std::unordered_map is
very slow and that this is a quite common operation in
ebos. Fortunately the fix for this problem is very simple: use the
tree-based std::map instead of the hash function based
std::unordered_map.

on SPE9 this yielded a performance improvement of about 10% on my
machine...
This commit is contained in:
Andreas Lauser
2015-02-12 12:26:03 +01:00
parent a28affc2cf
commit 7a729e73ac

View File

@@ -35,7 +35,7 @@
#include <dune/common/version.hh> #include <dune/common/version.hh>
#include <dune/geometry/referenceelements.hh> #include <dune/geometry/referenceelements.hh>
#include <unordered_map> #include <map>
namespace Opm { namespace Opm {
namespace Properties { namespace Properties {
@@ -1414,7 +1414,7 @@ protected:
std::string name_; std::string name_;
std::unordered_map<int, DofVariables> dofVariables_; std::map<int, DofVariables> dofVariables_;
// the number of times beginIteration*() was called for the current time step // the number of times beginIteration*() was called for the current time step
int iterationIdx_; int iterationIdx_;