From 25a9668382bc9832f1d8484932f7e716bac873ad Mon Sep 17 00:00:00 2001 From: mpg Date: Fri, 20 Apr 2018 14:17:30 -0400 Subject: [PATCH] added benchmarks (#9) --- operations/operations_test.go | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/operations/operations_test.go b/operations/operations_test.go index 149082b..a13fb29 100644 --- a/operations/operations_test.go +++ b/operations/operations_test.go @@ -137,3 +137,45 @@ func TestConvert(t *testing.T) { } } } + +func BenchmarkConvertEtMerc(b *testing.B) { + + ps, _ := support.NewProjString("+proj=utm +zone=32 +ellps=GRS80") + _, opx, _ := core.NewSystem(ps) + op := opx.(core.IConvertLPToXY) + input := &core.CoordLP{Lam: support.DDToR(12.0), Phi: support.DDToR(55.0)} + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, _ = op.Forward(input) + } +} + +func BenchmarkConvertAea(b *testing.B) { + + ps, _ := support.NewProjString("+proj=aea +ellps=GRS80 +lat_1=0 +lat_2=2") + _, opx, _ := core.NewSystem(ps) + op := opx.(core.IConvertLPToXY) + input := &core.CoordLP{Lam: support.DDToR(12.0), Phi: support.DDToR(55.0)} + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, _ = op.Forward(input) + } +} + +func BenchmarkConvertAiry(b *testing.B) { + + ps, _ := support.NewProjString("+proj=airy +a=6400000 +lat_1=0 +lat_2=2") + _, opx, _ := core.NewSystem(ps) + op := opx.(core.IConvertLPToXY) + input := &core.CoordLP{Lam: support.DDToR(12.0), Phi: support.DDToR(55.0)} + + b.ResetTimer() + + for i := 0; i < b.N; i++ { + _, _ = op.Forward(input) + } +}