progs/re2.scala
changeset 434 8664ff87cd77
parent 424 1129024b26d5
child 440 e14cd32ad497
equal deleted inserted replaced
433:c08290ee4f1f 434:8664ff87cd77
    52   for (j <- 1 to i) code
    52   for (j <- 1 to i) code
    53   val end = System.nanoTime()
    53   val end = System.nanoTime()
    54   (end - start)/(i * 1.0e9)
    54   (end - start)/(i * 1.0e9)
    55 }
    55 }
    56 
    56 
    57 for (i <- 1 to 100) {
       
    58   println(i + ": " + "%.5f".format(time_needed(1, matches(EVIL1(i), "a" * i))))
       
    59 }
       
    60 
    57 
    61 //a bit bolder tests
    58 //test: (a?{n}) (a{n})
    62 for (i <- 1 to 1001 by 50) {
    59 for (i <- 1 to 1101 by 100) {
    63   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
    60   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
    64 }
    61 }
    65 
    62 
       
    63 for (i <- 1 to 1101 by 100) {
       
    64   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
       
    65 }
       
    66 
       
    67 //test: (a*)* b
       
    68 for (i <- 1 to 4501 by 500) {
       
    69   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
       
    70 }
    66 
    71 
    67 for (i <- 1 to 4501 by 500) {
    72 for (i <- 1 to 4501 by 500) {
    68   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
    73   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
    69 }
    74 }
    70 
    75