paulmach / go.geo

Geometry/geography library in Go, DEPRECATED, use ->
https://github.com/paulmach/orb
MIT License
330 stars 55 forks source link

Fix Benchmarks for go1.5 #27

Closed paulmach closed 9 years ago

paulmach commented 9 years ago

FYI @mlerner

Go1.5 was optimizing out the benchmarks. A good problem to have :)

Here is the go 1.4.2 -> 1.5.1 comparison. Lots of nice wins.

benchmark                                        old ns/op      new ns/op      delta
BenchmarkPointSetCentroid-4                      71.8           45.3           -36.91%
BenchmarkPointSetGeoCentroid-4                   393            383            -2.54%
BenchmarkPointScan-4                             159            61.8           -61.13%
BenchmarkPointUnmarshalWKB-4                     32.2           31.5           -2.17%
BenchmarkLineScan-4                              184            92.5           -49.73%
BenchmarkLineUnmarshalWKB-4                      56.1           55.7           -0.71%
BenchmarkPathScan-4                              512            274            -46.48%
BenchmarkPathUnmarshalWKB-4                      403            227            -43.67%
BenchmarkLineDistanceFrom-4                      10.0           8.48           -15.20%
BenchmarkLineSquaredDistanceFrom-4               7.41           7.38           -0.40%
BenchmarkLineProject-4                           6.72           6.47           -3.72%
BenchmarkLineMeasure-4                           18.7           15.6           -16.58%
BenchmarkLineInterpolate-4                       55.2           28.7           -48.01%
BenchmarkLineMidpoint-4                          53.4           28.5           -46.63%
BenchmarkLineGeoMidpoint-4                       239            211            -11.72%
BenchmarkLineEquals-4                            6.82           6.39           -6.30%
BenchmarkLineClone-4                             85.6           33.1           -61.33%
BenchmarkPathDistanceFrom-4                      4421           3479           -21.31%
BenchmarkPathSquaredDistanceFrom-4               4435           3393           -23.49%
BenchmarkPathMeasure-4                           6850           5478           -20.03%
BenchmarkPathResampleToMorePoints-4              21185          10475          -50.55%
BenchmarkPathResampleToLessPoints-4              9098           3819           -58.02%
BenchmarkPathEncode-4                            19317          13375          -30.76%
BenchmarkPathFromEncoding-4                      17632          5622           -68.11%
BenchmarkPointDistanceFrom-4                     5.27           3.11           -40.99%
BenchmarkPointSquaredDistanceFrom-4              1.49           1.31           -12.08%
BenchmarkPointQuadKey-4                          256            255            -0.39%
BenchmarkPointQuadKeyString-4                    596            447            -25.00%
BenchmarkPointGeoHash-4                          231            198            -14.29%
BenchmarkPointGeoHashInt64-4                     149            148            -0.67%
BenchmarkPointNormalize-4                        15.1           11.4           -24.50%
BenchmarkPointEquals-4                           0.99           1.00           +1.01%
BenchmarkPointClone-4                            54.1           27.2           -49.72%
BenchmarkClusterClusters-4                       143126301      130954611      -8.50%
BenchmarkClusterPointers-4                       3711591624     3424795341     -7.73%
BenchmarkClusterGeoClusters-4                    78149551       71346614       -8.71%
BenchmarkInitClusterDistances-4                  27381723       21323395       -22.13%
BenchmarkRemoveOutlierPointersByQuadkey-4        5344431        4860554        -9.05%
BenchmarkPrefilteredClusterClustering-4          143850805      138365858      -3.81%
BenchmarkPrefilteredGeoProjectedClustering-4     81822643       77884703       -4.81%
BenchmarkDouglasPeucker-4                        10071865       10048492       -0.23%
BenchmarkDouglasPeuckerIndexMap-4                10389549       9913200        -4.58%
BenchmarkRadial-4                                607360         586823         -3.38%
BenchmarkRadialIndexMap-4                        681847         662120         -2.89%
BenchmarkVisvalingamThreshold-4                  33973814       29937275       -11.88%
BenchmarkVisvalingamKeep-4                       17555536       15731477       -10.39%

benchmark                               old allocs     new allocs     delta
BenchmarkPointSetCentroid-4             1              1              +0.00%
BenchmarkPointSetGeoCentroid-4          1              1              +0.00%
BenchmarkPointScan-4                    1              0              -100.00%
BenchmarkPointUnmarshalWKB-4            0              0              +0.00%
BenchmarkLineScan-4                     1              0              -100.00%
BenchmarkLineUnmarshalWKB-4             0              0              +0.00%
BenchmarkPathScan-4                     2              1              -50.00%
BenchmarkPathUnmarshalWKB-4             1              1              +0.00%
BenchmarkLineDistanceFrom-4             0              0              +0.00%
BenchmarkLineSquaredDistanceFrom-4      0              0              +0.00%
BenchmarkLineProject-4                  0              0              +0.00%
BenchmarkLineMeasure-4                  0              0              +0.00%
BenchmarkLineInterpolate-4              1              1              +0.00%
BenchmarkLineMidpoint-4                 1              1              +0.00%
BenchmarkLineGeoMidpoint-4              1              1              +0.00%
BenchmarkLineEquals-4                   0              0              +0.00%
BenchmarkLineClone-4                    1              1              +0.00%
BenchmarkPathDistanceFrom-4             0              0              +0.00%
BenchmarkPathSquaredDistanceFrom-4      0              0              +0.00%
BenchmarkPathMeasure-4                  0              0              +0.00%
BenchmarkPathResampleToMorePoints-4     2              2              +0.00%
BenchmarkPathResampleToLessPoints-4     2              2              +0.00%
BenchmarkPathEncode-4                   6              6              +0.00%
BenchmarkPathFromEncoding-4             10             10             +0.00%
BenchmarkPointDistanceFrom-4            0              0              +0.00%
BenchmarkPointSquaredDistanceFrom-4     0              0              +0.00%
BenchmarkPointQuadKey-4                 0              0              +0.00%
BenchmarkPointQuadKeyString-4           2              2              +0.00%
BenchmarkPointGeoHash-4                 1              1              +0.00%
BenchmarkPointGeoHashInt64-4            0              0              +0.00%
BenchmarkPointNormalize-4               0              0              +0.00%
BenchmarkPointEquals-4                  0              0              +0.00%
BenchmarkPointClone-4                   1              1              +0.00%
BenchmarkDouglasPeucker-4               9              9              +0.00%
BenchmarkDouglasPeuckerIndexMap-4       21             21             +0.00%
BenchmarkRadial-4                       20             20             +0.00%
BenchmarkRadialIndexMap-4               39             39             +0.00%
BenchmarkVisvalingamThreshold-4         73756          73755          -0.00%
BenchmarkVisvalingamKeep-4              73756          73758          +0.00%

benchmark                               old bytes     new bytes     delta
BenchmarkPointSetCentroid-4             16            16            +0.00%
BenchmarkPointSetGeoCentroid-4          16            16            +0.00%
BenchmarkPointScan-4                    32            0             -100.00%
BenchmarkPointUnmarshalWKB-4            0             0             +0.00%
BenchmarkLineScan-4                     32            0             -100.00%
BenchmarkLineUnmarshalWKB-4             0             0             +0.00%
BenchmarkPathScan-4                     128           96            -25.00%
BenchmarkPathUnmarshalWKB-4             96            96            +0.00%
BenchmarkLineDistanceFrom-4             0             0             +0.00%
BenchmarkLineSquaredDistanceFrom-4      0             0             +0.00%
BenchmarkLineProject-4                  0             0             +0.00%
BenchmarkLineMeasure-4                  0             0             +0.00%
BenchmarkLineInterpolate-4              16            16            +0.00%
BenchmarkLineMidpoint-4                 16            16            +0.00%
BenchmarkLineGeoMidpoint-4              16            16            +0.00%
BenchmarkLineEquals-4                   0             0             +0.00%
BenchmarkLineClone-4                    32            32            +0.00%
BenchmarkPathDistanceFrom-4             0             0             +0.00%
BenchmarkPathSquaredDistanceFrom-4      0             0             +0.00%
BenchmarkPathMeasure-4                  0             0             +0.00%
BenchmarkPathResampleToMorePoints-4     9727          9727          +0.00%
BenchmarkPathResampleToLessPoints-4     3840          3840          +0.00%
BenchmarkPathEncode-4                   3168          3168          +0.00%
BenchmarkPathFromEncoding-4             8208          8208          +0.00%
BenchmarkPointDistanceFrom-4            0             0             +0.00%
BenchmarkPointSquaredDistanceFrom-4     0             0             +0.00%
BenchmarkPointQuadKey-4                 0             0             +0.00%
BenchmarkPointQuadKeyString-4           80            80            +0.00%
BenchmarkPointGeoHash-4                 16            16            +0.00%
BenchmarkPointGeoHashInt64-4            0             0             +0.00%
BenchmarkPointNormalize-4               0             0             +0.00%
BenchmarkPointEquals-4                  0             0             +0.00%
BenchmarkPointClone-4                   16            16            +0.00%
BenchmarkDouglasPeucker-4               127504        127504        +0.00%
BenchmarkDouglasPeuckerIndexMap-4       154376        154394        +0.01%
BenchmarkRadial-4                       630544        630544        +0.00%
BenchmarkRadialIndexMap-4               918025        918032        +0.00%
BenchmarkVisvalingamThreshold-4         4152256       4152281       +0.00%
BenchmarkVisvalingamKeep-4              4875456       4875617       +0.00%
paulmach commented 9 years ago

Fixed the Visvalingam allocations

benchmark                           old ns/op     new ns/op     delta
BenchmarkVisvalingamThreshold-4     31662873      26382193      -16.68%
BenchmarkVisvalingamKeep-4          15825549      11250108      -28.91%

benchmark                           old allocs     new allocs     delta
BenchmarkVisvalingamThreshold-4     73755          8              -99.99%
BenchmarkVisvalingamKeep-4          73757          17             -99.98%

benchmark                           old bytes     new bytes     delta
BenchmarkVisvalingamThreshold-4     4152311       3569745       -14.03%
BenchmarkVisvalingamKeep-4          4875584       4293495       -11.94%