rpuch commented on code in PR #4689:
URL: https://github.com/apache/ignite-3/pull/4689#discussion_r1833810359
##########
modules/network/src/main/java/org/apache/ignite/internal/network/netty/OutboundEncoder.java:
##########
@@ -98,11 +98,17 @@ private NetworkMessageChunkedInput(
this.serializationService = serializationService;
this.msg = outObject.networkMessage();
- List<ClassDescriptorMessage> outDescriptors =
outObject.descriptors().stream()
- .filter(classDescriptorMessage ->
!serializationService.isDescriptorSent(classDescriptorMessage.descriptorId()))
- .collect(Collectors.toList());
+ List<ClassDescriptorMessage> outDescriptors = null;
+ for (ClassDescriptorMessage classDescriptorMessage :
outObject.descriptors()) {
Review Comment:
It is possible, but foreach loop doesn't perform worse than the classic
`for` loop on indexes. I checked allocations in the profiler, the iterator is
not even allocated (probably, escape analysis does its trick). On the other
hand, foreach loop is more readable and less prone to coding errors (less
moving parts are in the code where we can screw up)
--
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]