progs/re1.scala
changeset 434 8664ff87cd77
parent 433 c08290ee4f1f
child 440 e14cd32ad497
equal deleted inserted replaced
433:c08290ee4f1f 434:8664ff87cd77
    66   for (j <- 1 to i) code
    66   for (j <- 1 to i) code
    67   val end = System.nanoTime()
    67   val end = System.nanoTime()
    68   (end - start)/(i * 1.0e9)
    68   (end - start)/(i * 1.0e9)
    69 }
    69 }
    70 
    70 
       
    71 //test: (a?{n}) (a{n})
    71 for (i <- 1 to 20) {
    72 for (i <- 1 to 20) {
    72   println(i + ": " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
    73   println(i + ": " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
    73 }
    74 }
    74 
    75 
    75 
       
    76 for (i <- 1 to 20) {
    76 for (i <- 1 to 20) {
    77   println(i + ": " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
    77   println(i + ": " + "%.5f".format(time_needed(2, matches(EVIL1(i), "a" * i))))
       
    78 }
       
    79 
       
    80 //test: (a*)* b
       
    81 for (i <- 1 to 6502 by 500) {
       
    82   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
    78 }
    83 }
    79 
    84 
    80 for (i <- 1 to 6502 by 500) {
    85 for (i <- 1 to 6502 by 500) {
    81   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
    86   println(i + " " + "%.5f".format(time_needed(2, matches(EVIL2, "a" * i))))
    82 }
    87 }