PageRenderTime 27ms CodeModel.GetById 20ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/razpub/test_src/SpeedMap.scala

http://razpub.googlecode.com/
Scala | 28 lines | 23 code | 5 blank | 0 comment | 4 complexity | d71a88ad23ef4ec17f49909705eae7b2 MD5 | raw file
 1
 2import scala.collection._
 3
 4object SpeedMap {
 5  def main(args : Array[String]) : Unit = {
 6     val T = 100000
 7    
 8     for (laps <- 0 to 1800) {
 9     val im = immutable.HashMap[Int,String](1 -> "1", 2->"2", 0->"0")
10     val mm =   mutable.HashMap[Int,String](1 -> "1", 2->"2", 0->"0")
11     val jm =   new java.util.HashMap[Int,String]()
12     jm.put(1, "1")
13     jm.put(2, "r")
14     jm.put(3, "3")
15     
16     val t1 = System.currentTimeMillis()
17     for (i <- 0 to T) im.get(i % 3)
18     val t2 = System.currentTimeMillis()
19     for (i <- 0 to T) mm.get(i % 3)
20     val t3 = System.currentTimeMillis()
21     for (i <- 0 to T) jm.get(i % 3)
22     val t4 = System.currentTimeMillis()
23     
24     println (t2-t1, t3-t2, t4-t3)
25     Thread.sleep(100)
26     }
27  }
28}