alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (SeqViewBenches.scala)

This example Scala source code file (SeqViewBenches.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

array, dummy, dummy, dummyviewbenches, dummyviewbenches, dummyviewbenchlist, int, int, parseq, parseqview, parseqviewbenches, parview, seq, seq

The Scala SeqViewBenches.scala source code

package scala.collection.parallel
package benchmarks.parallel_view



import scala.collection.parallel.benchmarks.generic._
import scala.collection.SeqView










trait DummyViewBenches
extends ParSeqViewBenches[Dummy, ParSeqView[Dummy, ParSeq[Dummy], Seq[Dummy]], Seq[Dummy]] {
  def nameOfCollection = "ParView"
  def operators = DummyOperators
  def comparisonMap = collection.Map()
  val forkJoinPool = new scala.concurrent.forkjoin.ForkJoinPool
  def createSequential(sz: Int, p: Int) = {
    val s = new Array[Dummy](sz)
    for (i <- 0 until sz) s(i) = new Dummy(i)
    s
  }
  def createParallel(sz: Int, p: Int) = {
    val pa = new collection.parallel.mutable.ParArray[Dummy](sz)
    forkJoinPool.setParallelism(p)
    for (i <- 0 until sz) pa(i) = new Dummy(i)
    val v = pa.view
    collection.parallel.tasksupport.environment = forkJoinPool
    v
  }
  def createSeqView(sz: Int, p: Int) = createSequential(sz, p).view
}


object DummyViewBenchList extends DummyViewBenches










Other Scala examples (source code examples)

Here is a short list of links related to this Scala SeqViewBenches.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 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.