Use TBB parallel sort of CSV entries, #4418
This commit is contained in:
parent
f4dc93ae66
commit
b1358de9bb
@ -167,4 +167,3 @@ Feature: Traffic - speeds
|
|||||||
And the data has been extracted
|
And the data has been extracted
|
||||||
When I try to run "osrm-contract --segment-speed-file {speeds_file} {processed_file}"
|
When I try to run "osrm-contract --segment-speed-file {speeds_file} {processed_file}"
|
||||||
And it should exit successfully
|
And it should exit successfully
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include "util/log.hpp"
|
#include "util/log.hpp"
|
||||||
|
|
||||||
#include <tbb/parallel_for.h>
|
#include <tbb/parallel_for.h>
|
||||||
|
#include <tbb/parallel_sort.h>
|
||||||
#include <tbb/spin_mutex.h>
|
#include <tbb/spin_mutex.h>
|
||||||
|
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
@ -62,9 +63,9 @@ template <typename Key, typename Value> struct CSVFilesParser
|
|||||||
// and unique them on key to keep only the value with the largest file index
|
// and unique them on key to keep only the value with the largest file index
|
||||||
// and the largest line number in a file.
|
// and the largest line number in a file.
|
||||||
// The operands order is swapped to make descending ordering on (key, source)
|
// The operands order is swapped to make descending ordering on (key, source)
|
||||||
std::stable_sort(begin(lookup), end(lookup), [](const auto &lhs, const auto &rhs) {
|
tbb::parallel_sort(begin(lookup), end(lookup), [](const auto &lhs, const auto &rhs) {
|
||||||
return rhs.first < lhs.first ||
|
return std::tie(rhs.first, rhs.second.source) <
|
||||||
(rhs.first == lhs.first && rhs.second.source < lhs.second.source);
|
std::tie(lhs.first, lhs.second.source);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Unique only on key to take the source precedence into account and remove duplicates.
|
// Unique only on key to take the source precedence into account and remove duplicates.
|
||||||
|
Loading…
Reference in New Issue
Block a user