From 6bd74c287b5d89e24423e6bd8863a5119061381f Mon Sep 17 00:00:00 2001 From: Daniel Patterson Date: Wed, 5 Sep 2018 15:25:56 -0700 Subject: [PATCH] Add command-line parameter for enabling distance cache. --- include/contractor/contractor_config.hpp | 10 ++++++++-- src/tools/contract.cpp | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/include/contractor/contractor_config.hpp b/include/contractor/contractor_config.hpp index 8f1455cce..a9f026ce2 100644 --- a/include/contractor/contractor_config.hpp +++ b/include/contractor/contractor_config.hpp @@ -72,8 +72,14 @@ struct ContractorConfig final : storage::IOConfig // The remaining vertices form the core of the hierarchy //(e.g. 0.8 contracts 80 percent of the hierarchy, leaving a core of 20%) double core_factor; + + // Whether to store distances for CH edges in addition to duration/weight + // Defaults to false. Setting to true will require more storage/memory, + // but avoids the need for path unpacking to learn the distance of a CH + // route (useful for faster distance results in table queries) + bool cache_distances; }; -} -} +} // namespace contractor +} // namespace osrm #endif // EXTRACTOR_OPTIONS_HPP diff --git a/src/tools/contract.cpp b/src/tools/contract.cpp index 258e202f8..95402975f 100644 --- a/src/tools/contract.cpp +++ b/src/tools/contract.cpp @@ -81,7 +81,8 @@ return_code parseArguments(int argc, "time-zone-file", boost::program_options::value(&contractor_config.updater_config.tz_file_path), "Required for conditional turn restriction parsing, provide a geojson file containing " - "time zone boundaries"); + "time zone boundaries")("cache-distances",boost::program_options::bool_switch(&contractor_config.cache_distances)->default_value(false), + "Store distances for CH edges, avoiding the need for query-time re-calculation."); // hidden options, will be allowed on command line, but will not be shown to the user boost::program_options::options_description hidden_options("Hidden options");