All pastes #995556 Raw Edit

Someone

public text v1 · immutable
#995556 ·published 2008-04-24 08:41 UTC
rendered paste body
  def main(args: Array[String]) = {
    test()
  }
  
  def test() {
    var i = 0
    while (i < 10) {
      testInner()
      i += 1
    }
  }
  
  def testInner() {
    var leftCount = 0
    var rightCount = 0
    val right = Right("Something", "Something else")
    val left = Left("LeftS", "LeftSS")
    var time = System.currentTimeMillis
    var i = 0L
    while (i < 500000000L) {
      if (left.isRight)
        rightCount += 1
      if (right.isRight)
        rightCount += 1
      if (left.isLeft)
        leftCount += 1
      if (right.isLeft)
        leftCount += 1
      i += 1
    }
    time = System.currentTimeMillis - time
    println(time)
    println("LeftCount: " + leftCount + ", rightCount: " + rightCount)
  }