Skip to content

Commit d2dce59

Browse files
tniessenruyadorno
authored andcommitted
src: avoid copying BaseObjectPtrs in loop
While copying BaseObjectPtrs is cheap, it is not a no-op, so it is best to iterate over references to BaseObjectPtrs only. PR-URL: #44270 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Darshan Sen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent a3ac445 commit d2dce59

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/node_messaging.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ class SerializerDelegate : public ValueSerializer::Delegate {
349349
std::vector<BaseObjectPtr<BaseObject>> nested_transferables;
350350
if (!host_objects_[i]->NestedTransferables().To(&nested_transferables))
351351
return Nothing<bool>();
352-
for (auto nested_transferable : nested_transferables) {
352+
for (auto& nested_transferable : nested_transferables) {
353353
if (std::find(host_objects_.begin(),
354354
host_objects_.end(),
355355
nested_transferable) == host_objects_.end()) {

0 commit comments

Comments
 (0)