Copilot commented on code in PR #867:
URL: https://github.com/apache/incubator-graphar/pull/867#discussion_r2844127426


##########
cpp/src/graphar/high-level/graph_reader.cc:
##########
@@ -252,10 +253,9 @@ Result<std::vector<IdType>> 
VerticesCollection::filter_by_acero(
     filter_reader->next_chunk();
   }
   // std::cout << "Total valid count: " << total_count << std::endl;
-  std::vector<int64_t> indices64;
-
-  for (int value : indices) {
-    indices64.push_back(static_cast<int64_t>(value));
+  std::vector<int64_t> indices64(indices.size());
+  for (size_t i = 0; i < indices.size(); ++i) {
+    indices64[i] = static_cast<int64_t>(indices[i]);
   }

Review Comment:
   The vector preallocation optimization applied here could also be applied to 
the similar code pattern in the `filter` function above (lines 206-210) for 
consistency and performance. Consider applying the same optimization there as 
well.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to