rpuch commented on a change in pull request #670:
URL: https://github.com/apache/ignite-3/pull/670#discussion_r810814581



##########
File path: 
modules/network/src/main/java/org/apache/ignite/internal/network/serialization/PerSessionSerializationService.java
##########
@@ -182,6 +184,34 @@ public PerSessionSerializationService(@NotNull 
SerializationService serializatio
         return messages;
     }
 
+    private byte fieldFlags(FieldDescriptor fieldDescriptor) {
+        int bits = condMask(fieldDescriptor.isUnshared(), 
FieldDescriptorMessage.UNSHARED_MASK)
+                | condMask(fieldDescriptor.isPrimitive(), 
FieldDescriptorMessage.IS_PRIMITIVE)
+                | condMask(fieldDescriptor.isRuntimeTypeKnownUpfront(), 
FieldDescriptorMessage.IS_RUNTIME_TYPE_KNOWN_UPFRONT);
+        return (byte) bits;
+    }
+
+    private byte serializationAttributeFlags(Serialization serialization) {
+        int bits = condMask(serialization.hasWriteObject(), 
ClassDescriptorMessage.HAS_WRITE_OBJECT_MASK)
+                | condMask(serialization.hasReadObject(), 
ClassDescriptorMessage.HAS_READ_OBJECT_MASK)
+                | condMask(serialization.hasReadObjectNoData(), 
ClassDescriptorMessage.HAS_READ_OBJECT_NO_DATA_MASK)
+                | condMask(serialization.hasWriteReplace(), 
ClassDescriptorMessage.HAS_WRITE_REPLACE_MASK)
+                | condMask(serialization.hasReadResolve(), 
ClassDescriptorMessage.HAS_READ_RESOLVE_MASK);
+        return (byte) bits;
+    }
+
+    private int condMask(boolean value, int mask) {

Review comment:
       Are you concerned with performance here? If yes, than allocation of 2 
arrays per field message does not seem to be a good way to go.
   If `condMask()` becomes hot, it will be inlined, so it would turn into the 
usual `int flags = (a & MASK1) + (a & MASK2) + ...` which is superfast. If 
`condMask()` is not hot, then we should not bother about it performance at all.
   
   So I would leave it as it is now.




-- 
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]


Reply via email to