Search in sources :

Example 1 with LongSum

use of org.eclipse.collections.impl.math.LongSum in project eclipse-collections by eclipse.

the class ParallelArrayIterateTest method parallelForEachPerformanceTwoThreads.

@Test
public void parallelForEachPerformanceTwoThreads() throws InterruptedException {
    Object[] array = Interval.zeroTo(100).toArray();
    Sum parallelSum1 = new LongSum(0);
    Sum parallelSum2 = new LongSum(0);
    this.basicTestParallelSums(array, parallelSum1, parallelSum2);
    Sum linearSum1 = new LongSum(0);
    Sum linearSum2 = new LongSum(0);
    this.basicTestLinearSums(array, linearSum1, linearSum2);
    Assert.assertEquals(parallelSum1, linearSum1);
    Assert.assertEquals(parallelSum2, linearSum2);
}
Also used : LongSum(org.eclipse.collections.impl.math.LongSum) IntegerSum(org.eclipse.collections.impl.math.IntegerSum) Sum(org.eclipse.collections.impl.math.Sum) LongSum(org.eclipse.collections.impl.math.LongSum) Test(org.junit.Test)

Example 2 with LongSum

use of org.eclipse.collections.impl.math.LongSum in project eclipse-collections by eclipse.

the class ParallelArrayIterateTest method parallelForEachPerformanceOneThread.

@Test
public void parallelForEachPerformanceOneThread() {
    Object[] array = Interval.zeroTo(100).toArray();
    Sum parallelSum = new LongSum(0);
    this.parallelSum(array, parallelSum);
    Sum linearSum = new LongSum(0);
    this.linearSum(array, linearSum);
    Assert.assertEquals(parallelSum, linearSum);
}
Also used : LongSum(org.eclipse.collections.impl.math.LongSum) IntegerSum(org.eclipse.collections.impl.math.IntegerSum) Sum(org.eclipse.collections.impl.math.Sum) LongSum(org.eclipse.collections.impl.math.LongSum) Test(org.junit.Test)

Aggregations

IntegerSum (org.eclipse.collections.impl.math.IntegerSum)2 LongSum (org.eclipse.collections.impl.math.LongSum)2 Sum (org.eclipse.collections.impl.math.Sum)2 Test (org.junit.Test)2