nizhikov commented on code in PR #11816:
URL: https://github.com/apache/ignite/pull/11816#discussion_r1922712760


##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/BPlusTree.java:
##########
@@ -5724,8 +5724,16 @@ private final class ForwardCursor extends 
AbstractForwardCursor implements GridC
 
             for (int idx = startIdx; idx < cnt; idx++) {
                 if (c == null || c.apply(BPlusTree.this, io, pageAddr, idx)) {
-                    rows = GridArrays.set(rows, resCnt++, rowFactory == null ? 
getRow(io, pageAddr, idx, x) :
-                        rowFactory.create(BPlusTree.this, io, pageAddr, idx));
+                    T row;
+
+                    if (rowFactory != null)
+                        row = rowFactory.create(BPlusTree.this, io, pageAddr, 
idx);
+                    else if (c != null && c.lastRow() != null)
+                        row = c.lastRow();
+                    else
+                        row = getRow(io, pageAddr, idx, x);

Review Comment:
   May be this will be a bit faster? Single `c.lastRow()` invocation.
   ```suggestion
                       T row = null;
   
                       if (rowFactory != null)
                           row = rowFactory.create(BPlusTree.this, io, 
pageAddr, idx);
                       else {
                           if (c != null)
                               row = c.lastRow();
   
                           if (row == null)
                               row = getRow(io, pageAddr, idx, x);
                       }
   
                       rows = GridArrays.set(rows, resCnt++, row);
   ```



-- 
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: notifications-unsubscr...@ignite.apache.org

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

Reply via email to