changeset 7345:cc01521c9211

Fix the suggestTargetSize. Contributed-by: Doug Lea <dl@cs.oswego.edu>
author psandoz
date Mon, 18 Feb 2013 16:55:10 +0100
parents 66c0dd07e288
children 4da590a550a5
files src/share/classes/java/util/stream/AbstractTask.java
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/stream/AbstractTask.java	Mon Feb 18 15:09:19 2013 +0100
+++ b/src/share/classes/java/util/stream/AbstractTask.java	Mon Feb 18 16:55:10 2013 +0100
@@ -133,9 +133,8 @@
 
     /** Suggest a target leaf size based on the initial size estimate */
     public static long suggestTargetSize(long sizeEstimate) {
-        if (sizeEstimate == Long.MAX_VALUE)
-            sizeEstimate = 1000;  // @@@ SWAG
-        return 1 + ((sizeEstimate + 7) >>> 3) / ForkJoinPool.getCommonPoolParallelism();
+        long est = sizeEstimate / (ForkJoinPool.getCommonPoolParallelism() << 3);
+        return est > 0L ? est : 1L; // slack of 3; at least one
     }
 
     /**