@@ -53,9 +53,6 @@ template <> struct hash<std::pair<NodeID, NodeID>>
53
53
};
54
54
}
55
55
56
- // Buffer size of turn_indexes_write_buffer to reduce number of write(v) syscals
57
- const constexpr int TURN_INDEX_WRITE_BUFFER_SIZE = 1000 ;
58
-
59
56
namespace osrm
60
57
{
61
58
namespace extractor
@@ -449,10 +446,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
449
446
450
447
std::size_t node_based_edge_counter = 0 ;
451
448
452
- storage::tar::FileWriter turn_penalties_index_file (
453
- turn_penalties_index_filename, storage::tar::FileWriter::GenerateFingerprint);
454
- turn_penalties_index_file.WriteFrom (" /extractor/turn_index" , (char *)nullptr , 0 );
455
-
456
449
SuffixTable street_name_suffix_table (scripting_environment);
457
450
const auto &turn_lanes_data = transformTurnLaneMapIntoArrays (lane_description_map);
458
451
intersection::MergableRoadDetector mergable_road_detector (m_node_based_graph,
@@ -468,6 +461,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
468
461
// FIXME these need to be tuned in pre-allocated size
469
462
std::vector<TurnPenalty> turn_weight_penalties;
470
463
std::vector<TurnPenalty> turn_duration_penalties;
464
+ std::vector<lookup::TurnIndexBlock> turn_penalties_index;
471
465
472
466
// Now, renumber all our maneuver overrides to use edge-based-nodes
473
467
std::vector<StorageManeuverOverride> storage_maneuver_overrides;
@@ -487,14 +481,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
487
481
{
488
482
const NodeID node_count = m_node_based_graph.GetNumberOfNodes ();
489
483
490
- // Because we write TurnIndexBlock data as we go, we'll
491
- // buffer them into groups of 1000 to reduce the syscall
492
- // count by 1000x. This doesn't need much memory, but
493
- // greatly reduces the syscall overhead of writing lots
494
- // of small objects
495
- std::vector<lookup::TurnIndexBlock> turn_indexes_write_buffer;
496
- turn_indexes_write_buffer.reserve (TURN_INDEX_WRITE_BUFFER_SIZE);
497
-
498
484
// This struct is the buffered output of the `processor_stage`. This data is
499
485
// appended to the various output arrays/files by the `output_stage`.
500
486
// same as IntersectionData, but grouped with edge to allow sorting after creating.
@@ -510,7 +496,7 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
510
496
m_edge_based_edge_list.push_back (edge_with_data.edge );
511
497
turn_weight_penalties.push_back (edge_with_data.turn_weight_penalty );
512
498
turn_duration_penalties.push_back (edge_with_data.turn_duration_penalty );
513
- turn_indexes_write_buffer .push_back (edge_with_data.turn_index );
499
+ turn_penalties_index .push_back (edge_with_data.turn_index );
514
500
};
515
501
516
502
struct EdgesPipelineBuffer
@@ -1054,15 +1040,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
1054
1040
// NOTE: potential overflow here if we hit 2^32 routable edges
1055
1041
BOOST_ASSERT (m_edge_based_edge_list.size () <= std::numeric_limits<NodeID>::max ());
1056
1042
1057
- // Buffer writes to reduce syscall count
1058
- if (turn_indexes_write_buffer.size () >= TURN_INDEX_WRITE_BUFFER_SIZE)
1059
- {
1060
- turn_penalties_index_file.ContinueFrom (" /extractor/turn_index" ,
1061
- turn_indexes_write_buffer.data (),
1062
- turn_indexes_write_buffer.size ());
1063
- turn_indexes_write_buffer.clear ();
1064
- }
1065
-
1066
1043
// Copy via-way restrictions delayed data
1067
1044
delayed_data.insert (
1068
1045
delayed_data.end (), buffer->delayed_data .begin (), buffer->delayed_data .end ());
@@ -1118,15 +1095,6 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
1118
1095
1119
1096
storage_maneuver_overrides.push_back (storage_override);
1120
1097
}
1121
-
1122
- // Flush the turn_indexes_write_buffer if it's not empty
1123
- if (!turn_indexes_write_buffer.empty ())
1124
- {
1125
- turn_penalties_index_file.ContinueFrom (" /extractor/turn_index" ,
1126
- turn_indexes_write_buffer.data (),
1127
- turn_indexes_write_buffer.size ());
1128
- turn_indexes_write_buffer.clear ();
1129
- }
1130
1098
}
1131
1099
{
1132
1100
util::Log () << " Sorting and writing " << storage_maneuver_overrides.size ()
@@ -1162,9 +1130,11 @@ void EdgeBasedGraphFactory::GenerateEdgeExpandedEdges(
1162
1130
indexed_conditionals);
1163
1131
1164
1132
// write weight penalties per turn
1165
- BOOST_ASSERT (turn_weight_penalties.size () == turn_duration_penalties.size ());
1133
+ BOOST_ASSERT (turn_weight_penalties.size () == turn_duration_penalties.size () &&
1134
+ turn_weight_penalties.size () == turn_penalties_index.size ());
1166
1135
files::writeTurnWeightPenalty (turn_weight_penalties_filename, turn_weight_penalties);
1167
1136
files::writeTurnDurationPenalty (turn_duration_penalties_filename, turn_duration_penalties);
1137
+ files::writeTurnPenaltiesIndex (turn_penalties_index_filename, turn_penalties_index);
1168
1138
1169
1139
util::Log () << " Generated " << m_edge_based_node_segments.size () << " edge based node segments" ;
1170
1140
util::Log () << " Node-based graph contains " << node_based_edge_counter << " edges" ;
0 commit comments