summaryrefslogblamecommitdiff
path: root/test/benchmarks/src/scala/collection/parallel/benchmarks/hashtries/IntInit.scala
blob: 79ebd0e98c63ecaae3c02f76cad6372d503b7ec6 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14













                                                 
  



                                   
                              









                                                
 
package scala.collection.parallel.benchmarks
package hashtries




import collection.immutable.{HashMap => HashTrie}
import collection.mutable.HashMap



trait IntInit extends Bench {
  var hashmap: HashMap[Int, Int] = null
  var hashtrie: HashTrie[Int, Int] = null
  
  reset
  def reset = runWhat match {
    case "hashmap" => initHashMap
    case "hashtrie" => initHashTrie
    case "seq" => initHashTrie
  }
  def initHashTrie = {
    hashtrie = new HashTrie
    for (i <- 0 until size) hashtrie += ((i, i))
  }
  def initHashMap = {
    hashmap = new HashMap
    for (i <- 0 until size) hashmap += ((i, i))
  }

}