Aklakan commented on code in PR #3047: URL: https://github.com/apache/jena/pull/3047#discussion_r1983151248
########## jena-arq/src/main/java/org/apache/jena/sparql/exec/RowSetOps.java: ########## @@ -51,7 +51,7 @@ public static void consume(RowSet rowSet) * This operation consumes the RowSet. */ public static long count(RowSet rowSet) - { return rowSet.rewindable().size(); } + { long c[] = {0}; rowSet.forEach(b -> ++c[0]); return c[0]; } Review Comment: Behavior so far (IIRC): * For non-RowSetMem instances counting would create an intermediate in-memory copy. * The count for a RowSetMem instances would be the total number of bindings in the in-memory row set - rather than the number of remaining bindings. I added the method `RowSetStream.forEachRemaining` - the stack trace for `RowSetOps.count` using `rowSet.stream().count()` then becomes a delegate to the forEachRemaining method (with some stream creation overhead that should be neglectable for larger counts):  -- 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: pr-unsubscr...@jena.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@jena.apache.org For additional commands, e-mail: pr-h...@jena.apache.org