bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gperf-bugs] Gperf 2.7.2 test file questions


From: Bruno Haible
Subject: Re: [Gperf-bugs] Gperf 2.7.2 test file questions
Date: Thu, 28 Nov 2002 22:45:15 +0100 (CET)

Bruce Lilly writes:

> Key position set 1,2,6 will always use the first character of the key.
> For a key of length 5 only positions 1 and 2 of the key are used,
> compared to 3 positions used for set 2,4,5.
> 
> Comparing the two key position sets, it should be clear that 2,4,5
> will be better for keys with length 3 or less, that there is no
> advantage of either set for keys of length 4 or of length 6 or greater,
> and that 1,2,6 is more efficient only for keys of length 5.

On the other hand - if all positions can be chosen small enough (<=
minimal keyword length), then there is no switch statement in the
generated code, and this makes the code faster in all cases. So this
is an argument for trying to choose the positions as small as
possible.

> Moreover, $ means using key[len-1] which is slightly more
> computation than key[1], so even though the same two key positions are used
> in either case for a key of length 2, the one which does not use $ will
> be slightly more efficient.

I agree on this one. gperf-2.8 will prefer fixed positions to 'len-1'
when comparing two position sets with the same number of positions.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]