This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c/7344: performance regression on huge case statements


Hi,

On Thu, 17 Oct 2002, Nathanael Nerode wrote:

> What should we do for a test case here?  I feel that it should have one,
> but the minimal testcase is *inherently* 239K, so I'm not quite sure
> what to do here.

Nah.  One can reduce that with preprocessor magic, just like e.g.
20001226-1.c.  E.g. to produce 64 lines (the testcase has 10000), we would
do:

#define M(x) case x: f(); goto c;
#define M4(x) M(x) M(x+1) M(x+2) M(x+3)
#define M16(x) M4(x) M4(x+4) M4(x+8) M4(x+12)
#define M64(x) M16(x) M16(x+16) M16(x+32) M16(x+48)

void f();
void a()
{
  int b;
c: switch (b) {
  M64(1)
}
}


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]