1 #define _POSIX_C_SOURCE 200809L
10 void bench_regex_compile(int N) {
14 setlocale(LC_CTYPE, "");
16 regcomp(&re, "(a|b|c)*d*b", REG_EXTENDED);
21 static void regex_search(int N, char *s) {
26 setlocale(LC_CTYPE, "");
27 memset(buf, 'a', sizeof(buf)-2);
28 buf[sizeof buf - 2] = 'b';
29 buf[sizeof buf - 1] = 0;
30 regcomp(&re, s, REG_EXTENDED);
32 regexec(&re, buf, 0, 0, 0);
36 void bench_regex_search1(int N) {
37 regex_search(N, "(a|b|c)*d*b");
40 void bench_regex_search2(int N) {
41 regex_search(N, "a{25}b");