From: Ulya Trofimovich Date: Thu, 31 Dec 2015 20:17:16 +0000 (+0000) Subject: Added test for bug #128 "very slow DFA construction (resulting in a very large DFA)". X-Git-Tag: 0.16~1^2~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c604db18b943b2da44cebca6c816c5c08910ed73;p=re2c Added test for bug #128 "very slow DFA construction (resulting in a very large DFA)". After minimization the resulting DFA is much smaller: /*!re2c [ac]{0,14} [a] [ac]{0,14} {} */ Was: $ time re2c slow.re > slow.c && stat -c '%s' slow.c real 1m54.837s user 1m54.733s sys 0m0.120s 5627102 Now: $ time ./re2c slow.re > slow.c && stat -c '%s' slow.c real 0m0.732s user 0m0.684s sys 0m0.048s 15078 --- diff --git a/re2c/test/bug128.c b/re2c/test/bug128.c new file mode 100644 index 00000000..f4b5b8e9 --- /dev/null +++ b/re2c/test/bug128.c @@ -0,0 +1,966 @@ +/* Generated by re2c */ +#line 1 "bug128.re" +// This test produces a big DFA (which is further minimized). +// It used to be very slow and generated lots of code. + + +#line 8 "bug128.c" +{ + YYCTYPE yych; + if ((YYLIMIT - YYCURSOR) < 29) YYFILL(29); + yych = *YYCURSOR; + switch (yych) { + case 'a': goto yy4; + case 'c': goto yy6; + default: goto yy2; + } +yy2: + ++YYCURSOR; +yy3: +#line 6 "bug128.re" + {} +#line 23 "bug128.c" +yy4: + ++YYCURSOR; + switch ((yych = *YYCURSOR)) { + case 'a': goto yy7; + case 'c': goto yy8; + default: goto yy5; + } +yy5: +#line 5 "bug128.re" + {} +#line 34 "bug128.c" +yy6: + yych = *(YYMARKER = ++YYCURSOR); + switch (yych) { + case 'a': goto yy7; + case 'c': goto yy9; + default: goto yy3; + } +yy7: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy11; + case 'c': goto yy12; + default: goto yy5; + } +yy8: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy11; + case 'c': goto yy13; + default: goto yy5; + } +yy9: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy11; + case 'c': goto yy14; + default: goto yy10; + } +yy10: + YYCURSOR = YYMARKER; + goto yy3; +yy11: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy15; + case 'c': goto yy16; + default: goto yy5; + } +yy12: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy15; + case 'c': goto yy17; + default: goto yy5; + } +yy13: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy15; + case 'c': goto yy18; + default: goto yy5; + } +yy14: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy15; + case 'c': goto yy19; + default: goto yy10; + } +yy15: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy20; + case 'c': goto yy21; + default: goto yy5; + } +yy16: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy20; + case 'c': goto yy22; + default: goto yy5; + } +yy17: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy20; + case 'c': goto yy23; + default: goto yy5; + } +yy18: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy20; + case 'c': goto yy24; + default: goto yy5; + } +yy19: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy20; + case 'c': goto yy25; + default: goto yy10; + } +yy20: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy26; + case 'c': goto yy27; + default: goto yy5; + } +yy21: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy26; + case 'c': goto yy28; + default: goto yy5; + } +yy22: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy26; + case 'c': goto yy29; + default: goto yy5; + } +yy23: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy26; + case 'c': goto yy30; + default: goto yy5; + } +yy24: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy26; + case 'c': goto yy31; + default: goto yy5; + } +yy25: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy26; + case 'c': goto yy32; + default: goto yy10; + } +yy26: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy34; + default: goto yy5; + } +yy27: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy35; + default: goto yy5; + } +yy28: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy36; + default: goto yy5; + } +yy29: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy37; + default: goto yy5; + } +yy30: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy38; + default: goto yy5; + } +yy31: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy39; + default: goto yy5; + } +yy32: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy33; + case 'c': goto yy40; + default: goto yy10; + } +yy33: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy42; + default: goto yy5; + } +yy34: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy43; + default: goto yy5; + } +yy35: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy44; + default: goto yy5; + } +yy36: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy45; + default: goto yy5; + } +yy37: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy46; + default: goto yy5; + } +yy38: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy47; + default: goto yy5; + } +yy39: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy48; + default: goto yy5; + } +yy40: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy41; + case 'c': goto yy49; + default: goto yy10; + } +yy41: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy51; + default: goto yy5; + } +yy42: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy52; + default: goto yy5; + } +yy43: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy53; + default: goto yy5; + } +yy44: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy54; + default: goto yy5; + } +yy45: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy55; + default: goto yy5; + } +yy46: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy56; + default: goto yy5; + } +yy47: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy57; + default: goto yy5; + } +yy48: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy58; + default: goto yy5; + } +yy49: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy50; + case 'c': goto yy59; + default: goto yy10; + } +yy50: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy61; + default: goto yy5; + } +yy51: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy62; + default: goto yy5; + } +yy52: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy63; + default: goto yy5; + } +yy53: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy64; + default: goto yy5; + } +yy54: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy65; + default: goto yy5; + } +yy55: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy66; + default: goto yy5; + } +yy56: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy67; + default: goto yy5; + } +yy57: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy68; + default: goto yy5; + } +yy58: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy69; + default: goto yy5; + } +yy59: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy60; + case 'c': goto yy70; + default: goto yy10; + } +yy60: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy72; + default: goto yy5; + } +yy61: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy73; + default: goto yy5; + } +yy62: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy74; + default: goto yy5; + } +yy63: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy75; + default: goto yy5; + } +yy64: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy76; + default: goto yy5; + } +yy65: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy77; + default: goto yy5; + } +yy66: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy78; + default: goto yy5; + } +yy67: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy79; + default: goto yy5; + } +yy68: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy80; + default: goto yy5; + } +yy69: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy81; + default: goto yy5; + } +yy70: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy71; + case 'c': goto yy82; + default: goto yy10; + } +yy71: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy84; + default: goto yy5; + } +yy72: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy85; + default: goto yy5; + } +yy73: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy86; + default: goto yy5; + } +yy74: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy87; + default: goto yy5; + } +yy75: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy88; + default: goto yy5; + } +yy76: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy89; + default: goto yy5; + } +yy77: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy90; + default: goto yy5; + } +yy78: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy91; + default: goto yy5; + } +yy79: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy92; + default: goto yy5; + } +yy80: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy93; + default: goto yy5; + } +yy81: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy94; + default: goto yy5; + } +yy82: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy83; + case 'c': goto yy95; + default: goto yy10; + } +yy83: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy97; + default: goto yy5; + } +yy84: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy98; + default: goto yy5; + } +yy85: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy99; + default: goto yy5; + } +yy86: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy100; + default: goto yy5; + } +yy87: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy101; + default: goto yy5; + } +yy88: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy102; + default: goto yy5; + } +yy89: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy103; + default: goto yy5; + } +yy90: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy104; + default: goto yy5; + } +yy91: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy105; + default: goto yy5; + } +yy92: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy106; + default: goto yy5; + } +yy93: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy107; + default: goto yy5; + } +yy94: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy108; + default: goto yy5; + } +yy95: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy96; + case 'c': goto yy109; + default: goto yy10; + } +yy96: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy111; + default: goto yy5; + } +yy97: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy112; + default: goto yy5; + } +yy98: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy113; + default: goto yy5; + } +yy99: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy114; + default: goto yy5; + } +yy100: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy115; + default: goto yy5; + } +yy101: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy116; + default: goto yy5; + } +yy102: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy117; + default: goto yy5; + } +yy103: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy118; + default: goto yy5; + } +yy104: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy119; + default: goto yy5; + } +yy105: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy120; + default: goto yy5; + } +yy106: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy121; + default: goto yy5; + } +yy107: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy122; + default: goto yy5; + } +yy108: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy123; + default: goto yy5; + } +yy109: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy110; + case 'c': goto yy124; + default: goto yy10; + } +yy110: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy126; + default: goto yy5; + } +yy111: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy127; + default: goto yy5; + } +yy112: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy128; + default: goto yy5; + } +yy113: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy129; + default: goto yy5; + } +yy114: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy130; + default: goto yy5; + } +yy115: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy131; + default: goto yy5; + } +yy116: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy132; + default: goto yy5; + } +yy117: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy133; + default: goto yy5; + } +yy118: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy134; + default: goto yy5; + } +yy119: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy135; + default: goto yy5; + } +yy120: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy136; + default: goto yy5; + } +yy121: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy137; + default: goto yy5; + } +yy122: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy138; + default: goto yy5; + } +yy123: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + case 'c': goto yy139; + default: goto yy5; + } +yy124: + yych = *++YYCURSOR; + switch (yych) { + case 'a': goto yy125; + default: goto yy10; + } +yy125: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy126; + default: goto yy5; + } +yy126: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy127; + default: goto yy5; + } +yy127: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy128; + default: goto yy5; + } +yy128: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy129; + default: goto yy5; + } +yy129: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy130; + default: goto yy5; + } +yy130: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy131; + default: goto yy5; + } +yy131: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy132; + default: goto yy5; + } +yy132: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy133; + default: goto yy5; + } +yy133: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy134; + default: goto yy5; + } +yy134: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy135; + default: goto yy5; + } +yy135: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy136; + default: goto yy5; + } +yy136: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy137; + default: goto yy5; + } +yy137: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy138; + default: goto yy5; + } +yy138: + yych = *++YYCURSOR; + switch (yych) { + case 'a': + case 'c': goto yy139; + default: goto yy5; + } +yy139: + ++YYCURSOR; + yych = *YYCURSOR; + goto yy5; +} +#line 7 "bug128.re" + diff --git a/re2c/test/bug128.re b/re2c/test/bug128.re new file mode 100644 index 00000000..46d45403 --- /dev/null +++ b/re2c/test/bug128.re @@ -0,0 +1,7 @@ +// This test produces a big DFA (which is further minimized). +// It used to be very slow and generated lots of code. + +/*!re2c + [ac]{0,14} [a] [ac]{0,14} {} + * {} +*/