[core] Remove tile sorting from the clip and mask algorithms

The tile sorting can be now removed from the algorithms, which
calculate tile mask and clip ids, because their client code
provides tiles being already sorted (in `TilePyramid`).

This patch brings significant improvements to the Tile-related
performance tests results, for example the `TileMaskGeneration`
benchmark test runs 33 times faster with these changes applied.
This commit is contained in:
Mikhail Pozdnyakov
2019-01-18 13:12:04 +02:00
parent d5659aa664
commit b83030aa9b
5 changed files with 28 additions and 14 deletions

View File

@@ -45,7 +45,10 @@ void validate(const std::vector<MaskedRenderable> expected) {
std::vector<MaskedRenderable> actual = expected;
std::for_each(actual.begin(), actual.end(),
[](auto& renderable) { renderable.mask.clear(); });
algorithm::updateTileMasks<MaskedRenderable>({ actual.begin(), actual.end() });
std::vector<std::reference_wrapper<MaskedRenderable>> sorted(actual.begin(), actual.end());
std::sort(sorted.begin(), sorted.end(),
[](const MaskedRenderable& a, const MaskedRenderable& b){ return a.id < b.id; });
algorithm::updateTileMasks<MaskedRenderable>(std::move(sorted));
EXPECT_EQ(expected, actual);
}