75% speedup for zdump on 64-bit Solaris sparc

Paul Eggert eggert at CS.UCLA.EDU
Thu Mar 9 21:34:17 UTC 2006


Ken Pizzini <tz. at explicate.org> writes:

> On Wed, Mar 08, 2006 at 11:15:02PM -0800, Paul Eggert wrote:
>> ! 		int		lo = 1;
> [snip]
>> ! 		if (lo <= i && i < hi) {
>> ! 			if (t < sp->ats[i]) {
>> ! 				if (sp->ats[i - 1] <= t)
>> ! 					goto found;
>> ! 				i--;
>> ! 				if (sp->ats[i - 1] <= t)
>> ! 					goto found;
> [snip]
>> ! 	found:
>> ! 		guess = i;
>>   		i = (int) sp->types[i - 1];
>
> If i == lo (== 1), and the first <=t test fails

That can't happen, due to a previous test of t against sp->ats[0] (in
earlier code) which will will cause all the quoted code to be
bypassed.  So I don't see any bug there.


>>    it's quite a bit of
>> complexity for not much benefit, and think I'd prefer the simple
>> binary search.
>
> Me too.



More information about the tz mailing list