home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (SplitHalf.scala)

This example Scala source code file (SplitHalf.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, companion, cont, havingresult, int, int, nil, nil, resettable, splithalf, splithalf, string, string

The Scala SplitHalf.scala source code

package scala.collection.parallel.benchmarks.parallel_array


import scala.collection.parallel.benchmarks._


object SplitHalf extends Companion {
  def benchName = "split-half";
  def apply(sz: Int, parallelism: Int, what: String) = new SplitHalf(sz, parallelism, what)
  override def comparisons = Nil
  override def defaultSize = 50000
}

class SplitHalf(sz: Int, p: Int, what: String)
extends Resettable(sz, p, what, new Cont(_), new Array[Any](_), classOf[Cont])
with HavingResult[Int] {
  def companion = SplitHalf
  override def repetitionsPerRun = 300
  runresult = -1
  
  def runpar = runresult = pa.splitAt(pa.size / 2)._1.size
  def runseq = runresult = sequentialSplitAtOpt(sz / 2, sz)._1.size
  def comparisonMap = collection.Map()
}























Other Scala examples (source code examples)

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



my book on functional programming

 

new blog posts

 

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