You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hugegraph.apache.org by "imbajin (via GitHub)" <gi...@apache.org> on 2025/09/01 08:31:19 UTC

Re: [PR] perf(core): optimize perf by avoid boxing long [incubator-hugegraph]

imbajin commented on code in PR #2861:
URL: https://github.com/apache/incubator-hugegraph/pull/2861#discussion_r2313265321


##########
hugegraph-server/hugegraph-core/src/main/java/org/apache/hugegraph/backend/query/Query.java:
##########
@@ -180,7 +180,9 @@ public long offset() {
     }
 
     public void offset(long offset) {
-        E.checkArgument(offset >= 0L, "Invalid offset %s", offset);
+        if (offset < 0L) {

Review Comment:
   **Performance optimization concern**: While avoiding autoboxing is good, this pattern is harder to read and maintain. Consider using a static helper method instead:
   
   ```java
   private static void checkNonNegative(long value, String message, Object... args) {
       if (value < 0L) {
           E.checkArgument(false, message, args);
       }
   }
   ```
   
   Then call: `checkNonNegative(offset, "Invalid offset %s", offset);`



-- 
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: issues-unsubscribe@hugegraph.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org