forked from libgeos/geos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DistanceOp: Add short-circuit for point-point distance
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/********************************************************************** | ||
* | ||
* GEOS - Geometry Engine Open Source | ||
* http://geos.osgeo.org | ||
* | ||
* Copyright (C) 2021 Daniel Baston | ||
* | ||
* This is free software; you can redistribute and/or modify it under | ||
* the terms of the GNU Lesser General Public Licence as published | ||
* by the Free Software Foundation. | ||
* See the COPYING file for more information. | ||
* | ||
**********************************************************************/ | ||
|
||
#include <benchmark/benchmark.h> | ||
|
||
#include <BenchmarkUtils.h> | ||
#include <geos/geom/Coordinate.h> | ||
#include <geos/geom/Geometry.h> | ||
#include <geos/operation/distance/DistanceOp.h> | ||
|
||
using geos::operation::distance::DistanceOp; | ||
|
||
static void BM_PointPointDistance(benchmark::State& state) { | ||
geos::geom::Envelope e(-100, 100, -100, 100); | ||
auto points = geos::benchmark::createPoints(e, 100000); | ||
|
||
for (auto _ : state) { | ||
for (std::size_t i = 0; i < points.size(); i++) { | ||
for (std::size_t j = 0; i < points.size(); i++) { | ||
points[i]->distance(points[j].get()); | ||
} | ||
} | ||
} | ||
} | ||
|
||
BENCHMARK(BM_PointPointDistance); | ||
|
||
BENCHMARK_MAIN(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters