Mail Archives: djgpp/1997/12/23/07:30:17
On Mon, 22 Dec 1997, Anthony.Appleyard wrote:
|I have djgpp v2. A program contains a switch(c){ } statement which is obeyed
|very many times. c can be from 0 to 511. How can I make djgpp compile the
|switch() always as a lookup table of labels and not as a lot of time-wasting
|tests and jumps even if the resulting lookup table would be very gappy? I
|can't find anything about this in DJGPP\INFO\ or in the FAQ.
On a superscalar CPU, tests and jumps are almost always faster than a
sparse lookup table where cache misses will seriously slow down address
resolution, and the pipelines will always get stalled while ifetch is in
hazard. GCC does a very good job of detecting the threshold of when it is
faster to use a table. Trust it.
Wil Barath, aka WseM : "I feel as though I see my pen to write"
Author of VPM, EDITPLN, and other VGA Planets support programs
Visit my homepage! -------------> http://victoria.tc.ca/~wi534
- Raw text -