Skip to content

Commit 25a9668

Browse files
committed
added benchmarks (#9)
1 parent afa0995 commit 25a9668

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

operations/operations_test.go

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,45 @@ func TestConvert(t *testing.T) {
137137
}
138138
}
139139
}
140+
141+
func BenchmarkConvertEtMerc(b *testing.B) {
142+
143+
ps, _ := support.NewProjString("+proj=utm +zone=32 +ellps=GRS80")
144+
_, opx, _ := core.NewSystem(ps)
145+
op := opx.(core.IConvertLPToXY)
146+
input := &core.CoordLP{Lam: support.DDToR(12.0), Phi: support.DDToR(55.0)}
147+
148+
b.ResetTimer()
149+
150+
for i := 0; i < b.N; i++ {
151+
_, _ = op.Forward(input)
152+
}
153+
}
154+
155+
func BenchmarkConvertAea(b *testing.B) {
156+
157+
ps, _ := support.NewProjString("+proj=aea +ellps=GRS80 +lat_1=0 +lat_2=2")
158+
_, opx, _ := core.NewSystem(ps)
159+
op := opx.(core.IConvertLPToXY)
160+
input := &core.CoordLP{Lam: support.DDToR(12.0), Phi: support.DDToR(55.0)}
161+
162+
b.ResetTimer()
163+
164+
for i := 0; i < b.N; i++ {
165+
_, _ = op.Forward(input)
166+
}
167+
}
168+
169+
func BenchmarkConvertAiry(b *testing.B) {
170+
171+
ps, _ := support.NewProjString("+proj=airy +a=6400000 +lat_1=0 +lat_2=2")
172+
_, opx, _ := core.NewSystem(ps)
173+
op := opx.(core.IConvertLPToXY)
174+
input := &core.CoordLP{Lam: support.DDToR(12.0), Phi: support.DDToR(55.0)}
175+
176+
b.ResetTimer()
177+
178+
for i := 0; i < b.N; i++ {
179+
_, _ = op.Forward(input)
180+
}
181+
}

0 commit comments

Comments
 (0)