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: Daniel Berlin <dberlin at dberlin dot org>
- To: Nathanael Nerode <neroden at twcny dot rr dot com>
- Cc: gcc-gnats at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, nobody at gcc dot gnu dot org,rschiele at uni-mannhiem dot de, jh <jh at suse dot cz>
- Date: Thu, 10 Oct 2002 22:21:36 -0400
- Subject: Re: c/7344: performance regression on huge case statements
On Thursday, October 10, 2002, at 10:13 PM, Nathanael Nerode wrote:
Daniel Berlin wrote:
It doesn't cache the info (I think Jan said he could make it constant
time
in the alternative, which would also solve the problem), so it is
constantly recomputing a value that hasn't changed.
(...and one which is expensive to compute using the current algorithm)
This is the ironic part: It's not that expensive to compute.
It's O(log n)
It just used to be O(1), so it's 1-15 times slower than it used to be.
You wouldn't notice in most cases, because it scales so slowly.
In fact, I only cached it because on the tree-ssa-branch, because there
were cases where it was called 238 million times.
You start to notice at that point :).
--Dan