<div>Example of the change in -GT2 mode.</div><div><br></div><div>Instead of this:</div><div><br></div><div><div><div>st47:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ( ++p == pe )</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>goto _test_eof47;</div><div>case 47:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>switch( (*p) ) {</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 4u: goto tr118;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 5u: goto tr119;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 12u: goto tr118;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 13u: goto tr119;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 20u: goto tr118;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 21u: goto tr119;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 28u: goto tr118;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 29u: goto tr119;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 36u: goto tr118;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 37u: goto tr119;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 44u: goto tr118;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 45u: goto tr119;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 52u: goto tr118;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 53u: goto tr119;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 60u: goto tr118;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 61u: goto tr119;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 68u: goto tr121;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 76u: goto tr121;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 84u: goto tr121;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 92u: goto tr121;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 100u: goto tr121;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 108u: goto tr121;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 116u: goto tr121;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 124u: goto tr121;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 132u: goto tr123;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 140u: goto tr123;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 148u: goto tr123;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 156u: goto tr123;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 164u: goto tr123;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 172u: goto tr123;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>case 180u: goto tr123;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>case 188u: goto tr123;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ( (*p) < 64u ) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if ( (*p) <= 63u )</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>goto tr117;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} else if ( (*p) > 127u ) {</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if ( 128u <= (*p) && (*p) <= 191u )</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>goto tr122;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>} else</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>goto tr120;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>goto tr124;</div></div></div><div><br></div><div>We have this:</div><div>
<br></div><div><div>st47:</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if ( ++p == pe )</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>goto _test_eof47;</div><div>case 47:</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>{</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>static const unsigned char jump_table[] = { 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 3, 3, 3, 3, 4, 3, 3, 3, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 5, 5, 5, 5, 6, 5, 5, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7 };</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>cs = jump_table[(*p)] + 933;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>goto _again;</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>}</div>
</div><div><br></div><div>And this is basically all. Very small, very local change to -G2 mode which, as I've explained above, makes a world of difference in our case. If you replace ALL cases with jump tables then speed really suffers and size of the result grows significantly, if you only do this for cases with large number of outcomes then size actually shrinks and speed drop is moderate (negative in case of MSVC because we obviously hit some limits of the beast) since original code needs to do quite a large number of comparisons (or may be use some table behind the scene) anyway.</div>
<div><br></div><div>P.S. And is it possible to somehow really remove line numbers from the generated output? They are removed for all languages except C with -L flag, but for C they are just commented out. This increases size of generated file by about 10% needlessly :-( We can just filter them out, of course, but for all other languages you don't need this. Perhaps second -L can actually remove line numbers?</div>
<div><br></div>