equal
deleted
inserted
replaced
45 case (_, ZERO) => ZERO |
45 case (_, ZERO) => ZERO |
46 case (ONE, r2s) => r2s |
46 case (ONE, r2s) => r2s |
47 case (r1s, ONE) => r1s |
47 case (r1s, ONE) => r1s |
48 case (r1s, r2s) => SEQ(r1s, r2s) |
48 case (r1s, r2s) => SEQ(r1s, r2s) |
49 } |
49 } |
50 case NTIMES(r1, n) => NTIMES(simp(r), n) |
50 case NTIMES(r1, n) => NTIMES(simp(r1), n) |
51 case r => r |
51 case r => r |
52 } |
52 } |
53 |
53 |
54 |
54 |
55 // derivative w.r.t. a string (iterates der) |
55 // derivative w.r.t. a string (iterates der) |
76 for (j <- 1 to i) code |
76 for (j <- 1 to i) code |
77 val end = System.nanoTime() |
77 val end = System.nanoTime() |
78 (end - start)/(i * 1.0e9) |
78 (end - start)/(i * 1.0e9) |
79 } |
79 } |
80 |
80 |
81 val i = 5000 |
|
82 println(i + " " + "%.5f".format(time_needed(10, matcher(EVIL1(i), "a" * i)))) |
|
83 |
81 |
84 for (i <- 1 to 9001 by 1000) { |
82 //test: (a?{n}) (a{n}) |
|
83 for (i <- 1 to 10001 by 1000) { |
85 println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i)))) |
84 println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i)))) |
|
85 } |
|
86 |
|
87 for (i <- 1 to 10001 by 1000) { |
|
88 println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL1(i), "a" * i)))) |
|
89 } |
|
90 |
|
91 //test: (a*)* b |
|
92 for (i <- 1 to 7500001 by 500000) { |
|
93 println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i)))) |
86 } |
94 } |
87 |
95 |
88 for (i <- 1 to 7500001 by 500000) { |
96 for (i <- 1 to 7500001 by 500000) { |
89 println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i)))) |
97 println(i + " " + "%.5f".format(time_needed(2, matcher(EVIL2, "a" * i)))) |
90 } |
98 } |
91 |
99 |
92 |
|
93 |
|