Commit d6f933d5 authored by pawelpiotrowicz's avatar pawelpiotrowicz Committed by Scott Cyphers

no_fork: Performance issue vector of string to T (#3542)

* no_fork: Performance issue vector of string to T

* style
parent ef58667f
......@@ -16,6 +16,7 @@
#pragma once
#include <algorithm>
#include <chrono>
#include <cmath>
#include <cstdlib> // llvm 8.1 gets confused about `malloc` otherwise
......@@ -29,7 +30,6 @@
#include <typeinfo>
#include <unordered_map>
#include <vector>
#include "ngraph/axis_vector.hpp"
#include "ngraph/graph_util.hpp"
#include "ngraph/node.hpp"
......@@ -165,13 +165,10 @@ namespace ngraph
template <typename T>
std::vector<T> parse_string(const std::vector<std::string>& ss)
{
std::vector<T> result;
for (auto s : ss)
{
result.push_back(parse_string<T>(s));
}
std::vector<T> result(ss.size());
std::transform(ss.begin(), ss.end(), result.begin(), [](const std::string& s) {
return parse_string<T>(s);
});
return result;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment