This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c/7344: performance regression on huge case statements
- From: Michael Matz <matz at suse dot de>
- To: Nathanael Nerode <neroden at twcny dot rr dot com>
- Cc: <gcc-gnats at gcc dot gnu dot org>, <rschiele at uni-mannheim dot de>,<gcc-bugs at gcc dot gnu dot org>, <nobody at gcc dot gnu dot org>
- Date: Thu, 17 Oct 2002 15:19:30 +0200 (CEST)
- Subject: 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.