Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sort(a: Array[Int]) = {
- java.util.Arrays.sort(a)
- }
- def profile[T](what: String)(action: => T) = {
- val start = System.currentTimeMillis()
- val r = action
- val delta = System.currentTimeMillis() - start
- println(what + ": " + delta + "; " + r)
- }
- while (true) {
- val a = new Array[Int](20 * 1000 * 1000)
- val r = new java.util.Random
- for (i <- 1 to a.length) {
- a(i - 1) = r.nextInt()
- }
- profile("sort")(sort(a))
- }
- // vim: set ts=4 sw=4 et:
Add Comment
Please, Sign In to add comment