-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbtime.jl
More file actions
61 lines (52 loc) · 2.11 KB
/
Copy pathbtime.jl
File metadata and controls
61 lines (52 loc) · 2.11 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using DiscreteVoronoi
using BenchmarkTools
using Random
using StaticArrays
using DiscreteVoronoi: Coord, exact_aux, centre_anchor_aux, exact_aux_es, centre_anchor_aux_es
function random_coordinates(N, M, K)
Coord.(shuffle!([Iterators.product(1:N, 1:M)...])[1:min(N * M, K)])
end
for n in [400]
for s in [isqrt(n), n, n * isqrt(n), n * n]
@show n, s
println("jfa_voronoi!")
@btime jfa_voronoi!(grid, sites) setup = (
Random.seed!(42);
grid = zeros(Coord, ($n, $n));
sites = random_coordinates(size(grid)..., $s)) evals=1
if s <= n
println("dac_voronoi!")
@btime dac_voronoi!(grid, sites) setup=(
Random.seed!(42);
grid = zeros(Coord, ($n, $n));
sites = random_coordinates(size(grid)..., $s);
preset_voronoi!(grid, sites)) evals=1
end
println("redac_voronoi!")
@show exact_aux
@btime redac_voronoi!(grid, sites, auxiliary=exact_aux) setup=(
Random.seed!(42);
grid = zeros(Coord, ($n, $n));
sites = random_coordinates(size(grid)..., $s);
preset_voronoi!(grid, sites)) evals=1
@show centre_anchor_aux
@btime redac_voronoi!(grid, sites, auxiliary=centre_anchor_aux) setup=(
Random.seed!(42);
grid = zeros(Coord, ($n, $n));
sites = random_coordinates(size(grid)..., $s);
preset_voronoi!(grid, sites)) evals=1
println("redac_voronoi_es!")
@show exact_aux_es
@btime redac_voronoi_es!(grid, sites, auxiliary=exact_aux_es) setup=(
Random.seed!(42);
grid = zeros(Coord, ($n, $n));
sites = random_coordinates(size(grid)..., $s);
preset_voronoi!(grid, sites)) evals=1
@show centre_anchor_aux_es
@btime redac_voronoi_es!(grid, sites, auxiliary=centre_anchor_aux_es) setup=(
Random.seed!(42);
grid = zeros(Coord, ($n, $n));
sites = random_coordinates(size(grid)..., $s);
preset_voronoi!(grid, sites)) evals=1
end
end