javeme commented on code in PR #2704:
URL: 
https://github.com/apache/incubator-hugegraph/pull/2704#discussion_r2296135829


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/memory/consumer/factory/PropertyFactory.java:
##########
@@ -64,8 +67,11 @@ public HugeVertexProperty<V> 
newHugeVertexProperty(HugeElement owner, PropertyKe
                                                                               
.getCorrespondingTaskMemoryPool(
                                                                                
       Thread.currentThread()
                                                                                
             .getName());
-                return new HugeVertexPropertyOffHeap<>(
-                        taskMemoryPool.getCurrentWorkingOperatorMemoryPool(), 
owner, key, value);
+                return taskMemoryPool == null ?
+                       new HugeVertexProperty<>(owner, key, value) :
+                       new HugeVertexPropertyOffHeap<>(
+                               
taskMemoryPool.getCurrentWorkingOperatorMemoryPool(), owner, key,
+                               value);

Review Comment:
   can we avoid bytes copy in serializeSelfToByteBuf



##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/memory/consumer/factory/PropertyFactory.java:
##########
@@ -64,8 +67,11 @@ public HugeVertexProperty<V> 
newHugeVertexProperty(HugeElement owner, PropertyKe
                                                                               
.getCorrespondingTaskMemoryPool(
                                                                                
       Thread.currentThread()
                                                                                
             .getName());
-                return new HugeVertexPropertyOffHeap<>(
-                        taskMemoryPool.getCurrentWorkingOperatorMemoryPool(), 
owner, key, value);
+                return taskMemoryPool == null ?
+                       new HugeVertexProperty<>(owner, key, value) :
+                       new HugeVertexPropertyOffHeap<>(
+                               
taskMemoryPool.getCurrentWorkingOperatorMemoryPool(), owner, key,
+                               value);

Review Comment:
   1. preter to let OffHeapObject.serializeSelfToByteBuf return ByteBuf.
   2. can we rename OffHeapObject.zeroCopyReadFromByteBuf to readAsHeapObject?
   3. OffHeapObject.getAllMemoryBlock is useless? will we release an object 
individually?
   4. HugeVertexPropertyOffHeap.isPresent optimize with 'valueOffHeap != null'



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