Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def testCaseClassCost() {
- var loops = 0
- val foo : List[Int] = List(1,3,5,7)
- def funk(f : List[Int]) {loops += 1}
- var startTime = System.nanoTime
- while(loops < 1000000) {
- funk(List(1,3,5,7))
- }
- var delta = System.nanoTime - startTime
- println("Time with JIT list: " + (delta/1000000L))
- loops = 0
- startTime = System.nanoTime
- while(loops < 1000000) {
- funk(foo)
- }
- delta = System.nanoTime - startTime
- println("Time with prebuilt list: " + (delta/1000000L))
- }
Add Comment
Please, Sign In to add comment