dplagge opened a new issue, #1751:
URL: https://github.com/apache/jena/issues/1751

   ### Version
   
   4.7.0
   
   ### Question
   
   We delete a larger number of triples (tens of thousands) in a TDB2 database, 
and to track changes we use a `org.apache.jena.graph.compose.Delta` graph on 
top of it.
   With the number of deleted triples growing, the following method in `Delta` 
takes increasingly more time:
   ```
       protected ExtendedIterator<Triple> graphBaseFind(Triple t)
       {
           ExtendedIterator<Triple> iterator = 
base.find(t).filterDrop(ifIn(GraphUtil.findAll(deletions))).andThen(additions.find(t))
 ;
           return SimpleEventManager.notifyingRemove( this, iterator ) ;
       }
   ```
   The reason is that for each found triple, `findAll` is called and in `ifIn` 
a set of all triples in `deletions` is built.
   We overwrote the method by our own simplified implementation:
   ```
       protected ExtendedIterator<Triple> graphBaseFind(Triple t) {
           Graph deletions = getDeletions();
           Graph additions = getAdditions();
           ExtendedIterator<Triple> iterator = 
base.find(t).filterDrop(deletions::contains).andThen(additions.find(t));
           return SimpleEventManager.notifyingRemove(this, iterator);
       }
   ```
   For our current use case this seem to work very well. But I suppose there 
was a reason for the original implementation. Do I overlook something here?


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