File: OrientationIndexPerfTest.cpp

package info (click to toggle)
geos 3.14.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 31,212 kB
  • sloc: cpp: 199,103; xml: 56,065; ansic: 6,162; sh: 287; makefile: 26
file content (47 lines) | stat: -rw-r--r-- 1,502 bytes parent folder | download | duplicates (3)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**********************************************************************
 *
 * 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 <geos/geom/Coordinate.h>
#include <geos/algorithm/CGAlgorithmsDD.h>

using geos::geom::Coordinate;
using geos::algorithm::CGAlgorithmsDD;

static void BM_OrientationIndexFilter(benchmark::State& state) {
    Coordinate p0(219.3649559090992, 140.84159161824724);
    Coordinate p1(168.9018919682399, -5.713787599646864);
    Coordinate p(186.80814046338352, 46.28973405831556);

    for (auto _ : state) {
        benchmark::DoNotOptimize(CGAlgorithmsDD::orientationIndexFilter(p0.x, p0.y, p1.x, p1.y, p.x, p.y));
    }
}

static void BM_OrientationIndex(benchmark::State& state) {
    Coordinate p0(219.3649559090992, 140.84159161824724);
    Coordinate p1(168.9018919682399, -5.713787599646864);
    Coordinate p(186.80814046338352, 46.28973405831556);

    for (auto _ : state) {
        benchmark::DoNotOptimize(CGAlgorithmsDD::orientationIndex(p0.x, p0.y, p1.x, p1.y, p.x, p.y));
    }
}

BENCHMARK(BM_OrientationIndexFilter);
BENCHMARK(BM_OrientationIndex);

BENCHMARK_MAIN();