Fix performance issues after migration to sol2 3.3.0 (#6304)

* Fix performance issues after migration to sol2 3.3.0
This commit is contained in:
Siarhei Fedartsou 2022-08-16 00:10:56 +02:00 committed by GitHub
parent 440c00064e
commit 51a8486375
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 9 deletions

View File

@ -4,6 +4,7 @@
- FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294) - FIXED: Use Boost.Beast to parse HTTP request. [#6294](https://github.com/Project-OSRM/osrm-backend/pull/6294)
- FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113) - FIXED: Fix inefficient osrm-routed connection handling [#6113](https://github.com/Project-OSRM/osrm-backend/pull/6113)
- Misc: - Misc:
- FIXED: Fix performance issue after migration to sol2 3.3.0. [#6304](https://github.com/Project-OSRM/osrm-backend/pull/6304)
- CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298) - CHANGED: Pass osm_node_ids by reference in osrm::updater::Updater class. [#6298](https://github.com/Project-OSRM/osrm-backend/pull/6298)
- FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285) - FIXED: Fix bug with reading Set values from Lua scripts. [#6285](https://github.com/Project-OSRM/osrm-backend/pull/6285)
- FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296) - FIXED: Bug in bicycle profile that caused exceptions if there is a highway=bicycle in the data. [#6296](https://github.com/Project-OSRM/osrm-backend/pull/6296)

View File

@ -93,6 +93,10 @@ class ExtractionRelationContainer
using RelationIDList = std::vector<ExtractionRelation::OsmIDTyped>; using RelationIDList = std::vector<ExtractionRelation::OsmIDTyped>;
using RelationRefMap = std::unordered_map<std::uint64_t, RelationIDList>; using RelationRefMap = std::unordered_map<std::uint64_t, RelationIDList>;
ExtractionRelationContainer() = default;
ExtractionRelationContainer(ExtractionRelationContainer &&) = default;
ExtractionRelationContainer(const ExtractionRelationContainer &) = delete;
void AddRelation(ExtractionRelation &&rel) void AddRelation(ExtractionRelation &&rel)
{ {
rel.Prepare(); rel.Prepare();

View File

@ -1093,7 +1093,7 @@ void Sol2ScriptingEnvironment::ProcessTurn(ExtractionTurn &turn)
case 2: case 2:
if (context.has_turn_penalty_function) if (context.has_turn_penalty_function)
{ {
context.turn_function(context.profile_table, turn); context.turn_function(context.profile_table, std::ref(turn));
// Turn weight falls back to the duration value in deciseconds // Turn weight falls back to the duration value in deciseconds
// or uses the extracted unit-less weight value // or uses the extracted unit-less weight value
@ -1108,7 +1108,7 @@ void Sol2ScriptingEnvironment::ProcessTurn(ExtractionTurn &turn)
case 1: case 1:
if (context.has_turn_penalty_function) if (context.has_turn_penalty_function)
{ {
context.turn_function(turn); context.turn_function(std::ref(turn));
// Turn weight falls back to the duration value in deciseconds // Turn weight falls back to the duration value in deciseconds
// or uses the extracted unit-less weight value // or uses the extracted unit-less weight value
@ -1159,14 +1159,16 @@ void Sol2ScriptingEnvironment::ProcessSegment(ExtractionSegment &segment)
case 4: case 4:
case 3: case 3:
case 2: case 2:
context.segment_function(context.profile_table, segment); context.segment_function(context.profile_table, std::ref(segment));
break; break;
case 1: case 1:
context.segment_function(segment); context.segment_function(std::ref(segment));
break; break;
case 0: case 0:
context.segment_function( context.segment_function(std::ref(segment.source),
segment.source, segment.target, segment.distance, segment.duration); std::ref(segment.target),
segment.distance,
segment.duration);
segment.weight = segment.duration; // back-compatibility fallback to duration segment.weight = segment.duration; // back-compatibility fallback to duration
break; break;
} }
@ -1183,14 +1185,14 @@ void LuaScriptingContext::ProcessNode(const osmium::Node &node,
{ {
case 4: case 4:
case 3: case 3:
node_function(profile_table, std::cref(node), result, relations); node_function(profile_table, std::cref(node), std::ref(result), std::cref(relations));
break; break;
case 2: case 2:
node_function(profile_table, std::cref(node), result); node_function(profile_table, std::cref(node), std::ref(result));
break; break;
case 1: case 1:
case 0: case 0:
node_function(std::cref(node), result); node_function(std::cref(node), std::ref(result));
break; break;
} }
} }