diff --git a/core-java-modules/core-java-streams-3/pom.xml b/core-java-modules/core-java-streams-3/pom.xml
index 2ec2fa7c48..fb525decc3 100644
--- a/core-java-modules/core-java-streams-3/pom.xml
+++ b/core-java-modules/core-java-streams-3/pom.xml
@@ -27,6 +27,17 @@
${lombok.version}
provided
+
+ org.openjdk.jmh
+ jmh-core
+ ${jmh-core.version}
+
+
+ org.openjdk.jmh
+ jmh-generator-annprocess
+ ${jmh-generator.version}
+ test
+
org.assertj
diff --git a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/DifferentSourceSplitting.java b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/DifferentSourceSplitting.java
new file mode 100644
index 0000000000..37d7d25bf6
--- /dev/null
+++ b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/DifferentSourceSplitting.java
@@ -0,0 +1,52 @@
+package com.baeldung.streams.parallel;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.stream.IntStream;
+
+public class DifferentSourceSplitting {
+
+ private static final List arrayListOfNumbers = new ArrayList<>();
+ private static final List linkedListOfNumbers = new LinkedList<>();
+
+ static {
+ IntStream.rangeClosed(1, 100_000_000).forEach(i -> {
+ arrayListOfNumbers.add(i);
+ linkedListOfNumbers.add(i);
+ });
+ }
+
+ public static void main(String[] args) throws Exception {
+ org.openjdk.jmh.Main.main(args);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ public static void arrayListSequential() {
+ arrayListOfNumbers.stream().reduce(0, Integer::sum);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ public static void arrayListParallel() {
+ arrayListOfNumbers.parallelStream().reduce(0, Integer::sum);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ public static void linkedListSequential() {
+ linkedListOfNumbers.stream().reduce(0, Integer::sum);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ public static void linkedListParallel() {
+ linkedListOfNumbers.parallelStream().reduce(0, Integer::sum);
+ }
+
+}
diff --git a/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/SplittingCosts.java b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/SplittingCosts.java
new file mode 100644
index 0000000000..1f9f7f062b
--- /dev/null
+++ b/core-java-modules/core-java-streams-3/src/main/java/com/baeldung/streams/parallel/SplittingCosts.java
@@ -0,0 +1,26 @@
+package com.baeldung.streams.parallel;
+
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Mode;
+import java.util.stream.IntStream;
+
+public class SplittingCosts {
+
+ public static void main(String[] args) throws Exception {
+ org.openjdk.jmh.Main.main(args);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ public static void arrayListSequential() {
+ IntStream.rangeClosed(1, 1_000).reduce(0, Integer::sum);
+ }
+
+ @Benchmark
+ @BenchmarkMode(Mode.AverageTime)
+ public static void arrayListParallel() {
+ IntStream.rangeClosed(1, 1_000).parallel().reduce(0, Integer::sum);
+ }
+
+}