Re: glib hash memory footprint

On 01/09/04 06:08, Alan M. Evans wrote:

For a bonus, if the
array is kept sorted, then chained lookups can be binary searches. (Even
with the linked list, it is possible to reduce the cost of lookups if
the list is kept sorted.) This type of optimization is not possible with
linear probing.
The GHashTable API requires the user to provide a hash function and an equality function. How would you sort the items in the chain using these operators? Adding an extra API to specify a comparison function doesn't sound like a good idea, since glib would need to keep the code for programs that don't set a comparison function, and every existing program using GHashTable would need to be modified to take advantage of the optimisation.


Email: james jamesh id au

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