-
Notifications
You must be signed in to change notification settings - Fork 55
/
FinSets.jl
39 lines (31 loc) · 1.12 KB
/
FinSets.jl
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
using BenchmarkTools
const SUITE = BenchmarkGroup()
using Random
using Catlab.CategoricalAlgebra
bench = SUITE["Limits"] = BenchmarkGroup()
function benchmark_pullback(suite::BenchmarkGroup, name, cospan)
for alg in (NestedLoopJoin(), SortMergeJoin(), HashJoin())
suite["$name:$(nameof(typeof(alg)))"] =
@benchmarkable limit($cospan, alg=$alg)
end
end
sizes = (100, 150)
f, g = (FinFunction(ones(Int, size), 1) for size in sizes)
benchmark_pullback(bench, "pullback_terminal", Cospan(f, g))
f = FinFunction(identity, FinSet(10000))
benchmark_pullback(bench, "pullback_identity", Cospan(f, f))
n = 10000
Random.seed!(1)
f, g = FinFunction(randperm(n), n), FinFunction(randperm(n), n)
benchmark_pullback(bench, "pullback_randperm", Cospan(f, g))
k = 1000
sizes = (9000, 11000)
Random.seed!(1)
f, g = (FinFunction(rand(1:k, size), k) for size in sizes)
benchmark_pullback(bench, "pullback_randsparse", Cospan(f, g))
k = 50
sizes = (400, 500, 600)
Random.seed!(1)
f, g, h = (FinFunction(rand(1:k, size), k) for size in sizes)
benchmark_pullback(bench, "ternary_pullback_randsparse",
SMulticospan{3}(f, g, h))