|
Scala example source code file (ParallelRangeCheck.scala)
The Scala ParallelRangeCheck.scala source codepackage scala.collection.parallel package immutable import org.scalacheck._ import org.scalacheck.Gen import org.scalacheck.Gen._ import org.scalacheck.Prop._ import org.scalacheck.Properties import org.scalacheck.Arbitrary._ import scala.collection._ import scala.collection.parallel.ops._ object ParallelRangeCheck extends ParallelSeqCheck[Int]("ParallelRange[Int]") with ops.IntSeqOperators { // ForkJoinTasks.defaultForkJoinPool.setMaximumPoolSize(Runtime.getRuntime.availableProcessors * 2) // ForkJoinTasks.defaultForkJoinPool.setParallelism(Runtime.getRuntime.availableProcessors * 2) type CollType = collection.parallel.ParSeq[Int] def hasStrictOrder = true def isCheckingViews = false def ofSize(vals: Seq[Gen[Int]], sz: Int) = unsupported override def instances(vals: Seq[Gen[Int]]): Gen[Seq[Int]] = sized { start => sized { end => sized { step => new Range(start, end, if (step != 0) step else 1) } } } def fromSeq(a: Seq[Int]) = a match { case r: Range => ParRange(r.start, r.end, r.step, false) case _ => val pa = new parallel.mutable.ParArray[Int](a.length) for (i <- 0 until a.length) pa(i) = a(i) pa } override def traversable2Seq(t: Traversable[Int]): Seq[Int] = t match { case r: Range => r case _ => t.toSeq } def values = Seq(choose(-100, 100)) } Other Scala examples (source code examples)Here is a short list of links related to this Scala ParallelRangeCheck.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.