c/7344: performance regression on huge case statements
Daniel Berlin
dberlin@dberlin.org
Thu Oct 10 19:26:00 GMT 2002
The following reply was made to PR c/7344; it has been noted by GNATS.
From: Daniel Berlin <dberlin@dberlin.org>
To: Nathanael Nerode <neroden@twcny.rr.com>
Cc: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org,
rschiele@uni-mannhiem.de, jh <jh@suse.cz>
Subject: Re: c/7344: performance regression on huge case statements
Date: Thu, 10 Oct 2002 22:21:36 -0400
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
More information about the Gcc-prs
mailing list