forked from apache/jena
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
apacheGH-1279: Improve the implementation of in-memory, general-purpo…
…se,non-transactional graphs. Summary: - Improved performance of GraphMem for: - Graph#find - Slightly by tuning the filter predicates - Significantly when results are processed via Iterator#forEachRemaining - Graph#stream - Slightly by tuning the filter predicates - Significantly for most stream operations - java.util.stream.BaseStream#parallel is now fully supported. (Before these changes, parallel execution was even slower than single-threaded execution) - Graph#contains - Only for non-concrete (fluent) patterns - GraphMem used a variety of different Iterator implementations, helper classes, and wrappers: -> None of them supported #forEachRemaining -> It seemed appropriate to almost universally implement #forEachRemaining to avoid a wrapper or helper from breaking the newly gained performance advantages of #forEachRemaining Details: Implemented Iterator#forEachRemaining in an optimized way for many iterators throughout the Jena project: - Replaced hasNext();next(); calls by #forEachRemaining in some promising places (not all) Optimized NiceIterator: - NiceIterator#hasNext now avoids redundant calls to current.hasNext() - NiceIterator#andThen has optimized code to handle expensive hasNext calls of wrapped iterators. Tuned GraphMem: - Removed unused classes in the 'mem' namespace. - Iterators: - Tuned Iterator implementations, mainly by adding forEachRemaining implementations - Optimized code in BasicKeyIterator. The new iterator works in reverse order, so I had to adapt HashCommon#removeFrom - Optimized code in HashedBunchMap#iterator - TrackingTripleIterator#forEachRemaining now simply calls super.forEachRemaining() and sets current to null -> This had a significant impact on performance - Spliterators: - Created specialized spliterators SparseArraySpliterator and SparseArraySubSpliterator (+unit tests) - Replaced Spliterator implementation within HashCommon and HashedBunchMap with SparseArraySpliterator - Implemented Spliterators to support fast stream operations, where the SparseSpliterator* implementations were not suitable - Replaced usage of org.apache.jena.graph.impl.GraphBase#containsByFind with optimized implementations: - Introduced org.apache.jena.graph.impl.TripleStore#containsMatch - Implemented org.apache.jena.mem.NodeToTriplesMapBase#containsMatch using the spliterator - Filter operations: - Introduced org.apache.jena.graph.Triple.Field#filterOnConcrete to avoid double-checking of Node#isConcrete (+unit tests) - Created org.apache.jena.mem.FieldFilter to efficiently build filter predicates only when needed, and only with the required conditions (+unit tests) - Used org.apache.jena.mem.FieldFilter#filterOn in NodeToTriplesMap#iterator, NodeToTriplesMapBase#stream, and NodeToTriplesMapBase#containsMatch to only filter when a filter is needed. For example: For find(sub, ANY, ANY), there is no need for a filter in the underlying TripleBunch
- Loading branch information
1 parent
ba2cdb6
commit 8ef274a
Showing
74 changed files
with
2,618 additions
and
701 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.