Skip to content

Commit

Permalink
Add benchmark for route
Browse files Browse the repository at this point in the history
  • Loading branch information
SiarheiFedartsou committed May 22, 2024
1 parent e22e442 commit a6e268b
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/benchmarks/route.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <boost/assert.hpp>

#include <boost/optional/optional.hpp>
#include <cstdlib>
#include <exception>
#include <iostream>
Expand Down Expand Up @@ -49,6 +50,7 @@ try
RouteParameters::OverviewType overview;
bool steps = false;
std::optional<size_t> alternatives = std::nullopt;
std::optional<double> radius = std::nullopt;
};

auto run_benchmark = [&](const Benchmark &benchmark)
Expand All @@ -62,6 +64,12 @@ try
params.alternatives = *benchmark.alternatives;
}

if (benchmark.radius)
{
params.radiuses = std::vector<boost::optional<double>>(
params.coordinates.size(), boost::make_optional(*benchmark.radius));
}

TIMER_START(routes);
auto NUM = 1000;
for (int i = 0; i < NUM; ++i)
Expand Down Expand Up @@ -118,7 +126,29 @@ try
{FloatLongitude{7.412303912230966}, FloatLatitude{43.72851046529198}}},
RouteParameters::OverviewType::False,
false,
3}
3},
{"1000 routes, 3 coordinates, no alternatives, overview=false, steps=false, radius=750",
{{FloatLongitude{7.437602352715465}, FloatLatitude{43.75030522209604}},
{FloatLongitude{7.421844922513342}, FloatLatitude{43.73690777888953}},
{FloatLongitude{7.412303912230966}, FloatLatitude{43.72851046529198}}},
RouteParameters::OverviewType::False,
false,
std::nullopt,
750},
{"1000 routes, 2 coordinates, no alternatives, overview=false, steps=false, radius=750",
{{FloatLongitude{7.437602352715465}, FloatLatitude{43.75030522209604}},
{FloatLongitude{7.412303912230966}, FloatLatitude{43.72851046529198}}},
RouteParameters::OverviewType::False,
false,
std::nullopt,
750},
{"1000 routes, 2 coordinates, 3 alternatives, overview=false, steps=false, radius=750",
{{FloatLongitude{7.437602352715465}, FloatLatitude{43.75030522209604}},
{FloatLongitude{7.412303912230966}, FloatLatitude{43.72851046529198}}},
RouteParameters::OverviewType::False,
false,
3,
750}

};

Expand Down

0 comments on commit a6e268b

Please sign in to comment.