From 61d76622a4e2b6578304d811c1f50d24064561c5 Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Wed, 29 Jan 2020 19:23:31 +0100 Subject: [PATCH] reg3:: rule:: optimized link_structures --- reg3.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/reg3.cpp b/reg3.cpp index b3729db2..0d8b0b96 100644 --- a/reg3.cpp +++ b/reg3.cpp @@ -914,6 +914,8 @@ EX namespace reg3 { map> nonlooping_earlier_states; + vector> possible_states; + void find_mappings() { auto &nles = nonlooping_earlier_states; nles.clear(); @@ -971,6 +973,10 @@ EX namespace reg3 { } DEBB(DF_GEOM, ("removed cases = ", isize(bfs))); + + possible_states.resize(qstate); + for(auto& p: nonlooping_earlier_states) + possible_states[p.first.first].push_back(p.first.second); } hrmap_reg3_rule() : fp(0) { @@ -1212,10 +1218,7 @@ EX void link_structures(heptagon *h, heptagon *alt, hstate firststate) { alt->fiftyval = cm->root[alt->fieldval]; return; } - vector choices; - for(auto p: cm->nonlooping_earlier_states) - if(p.first.first == alt->fieldval) - choices.push_back(p.first.second); + vector& choices = cm->possible_states[alt->fieldval]; vector choices2; for(auto c: choices) { bool ok = true;