-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvoronoi.cpp
42 lines (32 loc) · 1.15 KB
/
voronoi.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "test_utils.hpp"
#include "geometry/voronoi.hpp"
#include "geometry/generator2d.hpp"
void speed_test_voronoi() {
vector<int> Ns = {6000, 15000, 30000, 50000, 100000, 200000, 300000, 500000, 800000};
vector<pair<int, PointDistrib>> inputs;
for (int N : Ns) {
for (int i = 0; i < int(PointDistrib::END); i++) {
inputs.push_back({N, PointDistrib(i)});
}
}
const auto runtime = 180000ms / inputs.size();
map<pair<stringable, int>, string> table;
for (auto [N, dist] : inputs) {
START_ACC(voronoi);
LOOP_FOR_DURATION_TRACKED_RUNS (runtime, now, runs) {
print_time(now, runtime, "speed voronoi {} N={}", N, to_string(dist));
auto pts = generate_points(N, dist, 0, 10'000'000);
ADD_TIME_BLOCK(voronoi) {
auto [F, hull, data, centers] = voronoi(pts);
box_voronoi(pts, data[0], centers);
Wedge::release();
}
}
table[{dist, N}] = FORMAT_EACH(voronoi, runs);
}
print_time_table(table, "Voronoi Diagram");
}
int main() {
RUN_BLOCK(speed_test_voronoi());
return 0;
}