Github user ajs6f commented on a diff in the pull request: https://github.com/apache/jena/pull/306#discussion_r152085996 --- Diff: jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java --- @@ -246,43 +282,214 @@ private static void deleteIteratorWorkerDirect(Graph graph, Iterator<Triple> it) } } - private static final int sliceSize = 1000 ; - /** A safe and cautious remove() function that converts the remove to - * a number of {@link Graph#delete(Triple)} operations. + private static int MIN_SRC_SIZE = 1000 ; + // If source and destination are large, limit the search for the best way round to "deleteFrom" + private static int MAX_SRC_SIZE = 1000*1000 ; + private static int DST_SRC_RATIO = 2 ; + + /** + * Delete triples in the destination (arg 1) as given in the source (arg 2). + * + * @implNote + * This is designed for the case of {@code dstGraph} being comparable or much larger than + * {@code srcGraph} or {@code srcGraph} having a lot of triples to actually be + * deleted from {@code dstGraph}. This includes large, persistent {@code dstGraph}. + * <p> + * It is not designed for a large {@code srcGraph} and large {@code dstGraph} + * with only a few triples in common delete from {@code dstGraph}. It is better to + * calculate the difference in someway, and copy into a small graph to use as the {@srcGraph}. --- End diff -- typo: some way
---