-
Notifications
You must be signed in to change notification settings - Fork 13
/
bench.jl
executable file
·32 lines (30 loc) · 1.13 KB
/
bench.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
#!/usr/bin/env julia
using SkyCoords
using BenchmarkTools
function myprintln(io, string)
println(io, string)
println(string)
end
io = open("julia_times.csv", "w")
println(io, "n,system,time")
for n in [1, 10, 100, 1000, 10_000, 100_000, 1_000_000]
if n == 1
c = ICRSCoords(2pi*rand(), pi*(rand() - 0.5))
t1 = minimum(@benchmark(convert(GalCoords, $c)).times)/1e9
myprintln(io, "$n,galactic,$t1")
t2 = minimum(@benchmark(convert(FK5Coords{2000}, $c)).times)/1e9
myprintln(io, "$n,fk5j2000,$t2")
t3 = minimum(@benchmark(convert(FK5Coords{1975}, $c)).times)/1e9
myprintln(io, "$n,fk5j1975,$t3")
else
c = [ICRSCoords(2pi*rand(), pi*(rand() - 0.5)) for i=1:n]
t1 = minimum(@benchmark(convert(Vector{GalCoords{Float64}}, $c)).times)/1e9
myprintln(io, "$n,galactic,$t1")
t2 = minimum(@benchmark(convert(Vector{FK5Coords{2000, Float64}}, $c)).times)/1e9
myprintln(io, "$n,fk5j2000,$t2")
t3 = minimum(@benchmark(convert(Vector{FK5Coords{1975, Float64}}, $c)).times)/1e9
myprintln(io, "$n,fk5j1975,$t3")
end
println()
end
close(io)