Further optimizations for province automapping #62
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notable changes:
isProvinceMapped
calls (which turned out to be very expensive).Included https://github.com/martinus/robin-hood-hashing for its faster (about 2x in my test runs) implementation ofEDIT: replaced with https://github.com/greg7mdp/gtlunordered_map
.ImageFrame
toAutomapper
, which seems a better place for it.final
.(sourcePixel.x + sourcePixel.y) % 2 == 0
. The code is about 32x faster, despite checking all source map pixels instead of only half of them, so it's no longer needed to reduce the mapping accuracy.Logged time measurements on Ryzen 7 7700, with I:R Terra Indomita to CK3 Rajas of Asia mappings being generated.
before (measured on an older version of Rajas of Asia, but shouldn't matter much):
after(see new updated in comment below):The first run always takes a longer time, because a point-province map is being initialized. It's reused in subsequent runs.