| author | Christian Urban <christian.urban@kcl.ac.uk> |
| Fri, 03 Dec 2021 22:07:11 +0000 | |
| changeset 857 | e748f5e09323 |
| parent 742 | 155426396b5f |
| permissions | -rw-r--r-- |
// measures the time a function needs def time_needed[T](i: Int, code: => T) = { val start = System.nanoTime() for (j <- 1 to i) code val end = System.nanoTime() (end - start)/(i * 1.0e9) } for (i <- 1 to 10001 by 300) { val re = ("((a?){" + i + "})(a{" + i + "})") println(i + " " + "%.5f".format(time_needed(1, ("a" * i).matches(re)))) }