This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new 18445d4 Tweak parallel querying of GINQ
18445d4 is described below
commit 18445d4cb3c95c33ad558adf58ac2e7d46c315f9
Author: Daniel Sun <[email protected]>
AuthorDate: Tue Jul 20 13:28:35 2021 +0800
Tweak parallel querying of GINQ
---
.../ginq/provider/collection/runtime/QueryableCollection.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git
a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
index c7c8cab..cbce2d2 100644
---
a/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
+++
b/subprojects/groovy-ginq/src/main/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollection.java
@@ -546,7 +546,11 @@ class QueryableCollection<T> implements Queryable<T>,
Serializable {
private static <T, U> Stream<Tuple2<T, U>> probeHashTable(Map<Integer,
List<Candidate<U>>> hashTable, T p, Function<? super T, ?> fieldsExtractor1) {
final Object otherFields = fieldsExtractor1.apply(p);
final Integer h = hash(otherFields);
- return hashTable.entrySet().stream()
+
+ Stream<Map.Entry<Integer, List<Candidate<U>>>> stream =
hashTable.entrySet().stream();
+ if (isParallel()) stream = stream.parallel();
+
+ return stream
.filter(entry -> h.equals(entry.getKey()))
.flatMap(entry -> {
List<Candidate<U>> candidateList = entry.getValue();