Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply micro-optimisation for Nearest API #6944

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions include/engine/api/nearest_api.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,23 +100,23 @@ class NearestAPI final : public BaseAPI
auto waypoint = MakeWaypoint({phantom_node});

util::json::Array nodes;
nodes.values.reserve(2);

auto node_values = MakeNodes(phantom_node);

nodes.values.push_back(node_values.first);
nodes.values.push_back(node_values.second);
waypoint.values["nodes"] = std::move(nodes);

nodes.values.emplace_back(node_values.first);
nodes.values.emplace_back(node_values.second);
waypoint.values.emplace("nodes", std::move(nodes));
return waypoint;
});
response.values["waypoints"] = std::move(waypoints);
response.values.emplace("waypoints", std::move(waypoints));
}

response.values["code"] = "Ok";
response.values.emplace("code", "Ok");
auto data_timestamp = facade.GetTimestamp();
if (!data_timestamp.empty())
{
response.values["data_version"] = data_timestamp;
response.values.emplace("data_version", data_timestamp);
}
}

Expand Down