Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 9edd122

Browse files
committed
Use DlRegionSorted as the algorithm
1 parent cd5ff74 commit 9edd122

File tree

6 files changed

+94
-521
lines changed

6 files changed

+94
-521
lines changed

display_list/benchmarking/dl_region_benchmarks.cc

Lines changed: 3 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,12 @@ class SkRegionAdapter {
2727
SkRegion region_;
2828
};
2929

30-
class DlRegion2Adapter {
30+
class DlRegionAdapter {
3131
public:
3232
void addRect(const SkIRect& rect) { rects_.push_back(rect); }
3333

3434
std::vector<SkIRect> getRects() {
35-
flutter::DlRegion2 region;
36-
region.addRects(std::move(rects_));
37-
return region.getRects(false);
38-
}
39-
40-
private:
41-
std::vector<SkIRect> rects_;
42-
};
43-
44-
class DlRegionSortedAdapter {
45-
public:
46-
void addRect(const SkIRect& rect) { rects_.push_back(rect); }
47-
48-
std::vector<SkIRect> getRects() {
49-
flutter::DlRegionSorted region;
35+
flutter::DlRegion region;
5036
region.addRects(std::move(rects_));
5137
return region.getRects(false);
5238
}
@@ -84,51 +70,23 @@ static void BM_RegionBenchmarkSkRegion(benchmark::State& state, int maxSize) {
8470
}
8571

8672
static void BM_RegionBenchmarkDlRegion(benchmark::State& state, int maxSize) {
87-
RunRegionBenchmark<DlRegion>(state, maxSize);
88-
}
89-
90-
static void BM_RegionBenchmarkDlRegionSorted(benchmark::State& state,
91-
int maxSize) {
92-
RunRegionBenchmark<DlRegionSortedAdapter>(state, maxSize);
93-
}
94-
95-
static void BM_RegionBenchmarkDlRegion2(benchmark::State& state, int maxSize) {
96-
RunRegionBenchmark<DlRegion2Adapter>(state, maxSize);
73+
RunRegionBenchmark<DlRegionAdapter>(state, maxSize);
9774
}
9875

9976
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion, Tiny, 30)
10077
->Unit(benchmark::kMicrosecond);
101-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion2, Tiny, 30)
102-
->Unit(benchmark::kMicrosecond);
103-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegionSorted, Tiny, 30)
104-
->Unit(benchmark::kMicrosecond);
10578
BENCHMARK_CAPTURE(BM_RegionBenchmarkSkRegion, Tiny, 30)
10679
->Unit(benchmark::kMicrosecond);
107-
10880
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion, Small, 100)
10981
->Unit(benchmark::kMicrosecond);
110-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion2, Small, 100)
111-
->Unit(benchmark::kMicrosecond);
112-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegionSorted, Small, 100)
113-
->Unit(benchmark::kMicrosecond);
11482
BENCHMARK_CAPTURE(BM_RegionBenchmarkSkRegion, Small, 100)
11583
->Unit(benchmark::kMicrosecond);
116-
11784
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion, Medium, 400)
11885
->Unit(benchmark::kMicrosecond);
119-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion2, Medium, 400)
120-
->Unit(benchmark::kMicrosecond);
121-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegionSorted, Medium, 400)
122-
->Unit(benchmark::kMicrosecond);
12386
BENCHMARK_CAPTURE(BM_RegionBenchmarkSkRegion, Medium, 400)
12487
->Unit(benchmark::kMicrosecond);
125-
12688
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion, Large, 1500)
12789
->Unit(benchmark::kMicrosecond);
128-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegion2, Large, 1500)
129-
->Unit(benchmark::kMicrosecond);
130-
BENCHMARK_CAPTURE(BM_RegionBenchmarkDlRegionSorted, Large, 1500)
131-
->Unit(benchmark::kMicrosecond);
13290
BENCHMARK_CAPTURE(BM_RegionBenchmarkSkRegion, Large, 1500)
13391
->Unit(benchmark::kMicrosecond);
13492

0 commit comments

Comments
 (0)