diff options
author | Marius Kintel <marius@kintel.net> | 2011-09-09 04:10:33 (GMT) |
---|---|---|
committer | Marius Kintel <marius@kintel.net> | 2011-09-09 04:10:33 (GMT) |
commit | 09cc0496f7ce61e2bcbce80e067e0fac8054599a (patch) | |
tree | 76905edf7f13f5bea18be54edfc98a64d994e382 /src/PolySetEvaluator.cc | |
parent | cbba974d3ac1edeb716a1384a2262ed5447fa9e6 (diff) |
Make PolySet cache global
Diffstat (limited to 'src/PolySetEvaluator.cc')
-rw-r--r-- | src/PolySetEvaluator.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/PolySetEvaluator.cc b/src/PolySetEvaluator.cc index 2808686..6426d6e 100644 --- a/src/PolySetEvaluator.cc +++ b/src/PolySetEvaluator.cc @@ -9,13 +9,15 @@ class. */ +QCache<std::string, PolySetEvaluator::cache_entry> PolySetEvaluator::cache(100000); + PolySet *PolySetEvaluator::getPolySet(const AbstractNode &node) { const string &cacheid = this->tree.getString(node); - if (this->cache.contains(cacheid)) return this->cache[cacheid]->ps; + if (cache.contains(cacheid)) return cache[cacheid]->ps; PolySet *ps = node.evaluate_polyset(this); - this->cache.insert(cacheid, new cache_entry(ps), ps?ps->polygons.size():0); + cache.insert(cacheid, new cache_entry(ps), ps?ps->polygons.size():0); return ps; } @@ -27,6 +29,6 @@ PolySetEvaluator::cache_entry::cache_entry(PolySet *ps) void PolySetEvaluator::printCache() { - PRINTF("PolySets in cache: %d", this->cache.size()); - PRINTF("Polygons in cache: %d", this->cache.totalCost()); + PRINTF("PolySets in cache: %d", cache.size()); + PRINTF("Polygons in cache: %d", cache.totalCost()); } |