Parallel Data Conversion
In this lesson, we will begin refactoring the data conversion part of our program.
We'll cover the following...
Using std::execution::par
As previously discussed, we can add parallel execution to the place where we convert the data. We have lots of lines to parse, each parsing is independent.
Press + to interact
[[nodiscard]] std::vector<OrderRecord>LinesToRecords(const std::vector<std::string_view>& lines){std::vector<OrderRecord> outRecords(lines.size());std::transform(std::execution::par, std::begin(lines), std::end(lines),std::begin(outRecords), LineToRecord);return outRecords;}
Two things needed to change to the serial version
- we need