75% speedup for zdump on 64-bit Solaris sparc

Ken Pizzini tz. at explicate.org
Thu Mar 9 10:47:20 UTC 2006


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, then i==0
and we're accessing sp->ats[-1] and sp->types[-1].  This can
be fixed, but as Paul said:

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

Me too.

		--Ken Pizzini



More information about the tz mailing list