arne-bdt opened a new issue, #2169:
URL: https://github.com/apache/jena/issues/2169

   ### Version
   
   5.0.0-SNAPSHOT
   
   ### Feature
   
   I've noticed that the requirement to clone a graph arises frequently in our 
codebase. 
   Currently, this is our approach:
   ```
   var copy = GraphFactory.createGraphMem();
   graph.find().forEachRemaining(copy::add);
   ```
   
   While this method is functional, I believe there is room for significant 
performance improvement. The attached chart illustrates the speed difference 
between the current method (findAndAddAll) and the proposed deep clone 
implementation (copy).
   
![image](https://github.com/apache/jena/assets/53625519/011d0aa2-e95c-476e-b4d1-57e32a7dca42)
   
   In one of my feature branches, I've implemented deep cloning for all three 
GraphMem2 implementations. Although I'm uncertain about how this could be 
integrated into the main Graph interface, it has proven to be highly beneficial 
for GraphMem2.
   
   To enable this feature, I provided copy constructors for all classes under 
mem2.collections and mem2.store.
   A notable concern with this approach is the added complexity it introduces 
to the codebase. While this complexity is manageable in my current context, 
it's important for the Jena community to evaluate and decide whether this 
aligns with the broader project goals and standards.
   
   Would this deep cloning feature be of interest for inclusion in the Jena 
project?
   
   For reference, here is GraphMem2#copy in my feature branch: 
[GraphMem2.java#L157](https://github.com/arne-bdt/jena/blob/d767ad6bcc796ea79c7cdf3221708d08a25dcc9e/jena-core/src/main/java/org/apache/jena/mem2/GraphMem2.java#L157)
   
   ### Are you interested in contributing a solution yourself?
   
   Yes


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