walderich
walderich

Reputation: 626

Find minimal perfect hash function with gperf

I found gperf to be suitable for my project and are now looking for a way to optimize the size of the generated table. As the switches -i and -j influence the length of the table deterministically, I wrote a small script iterating over those values, finding the minimal table length. The script stores the -i and -j values for retrieval of the current minimum table as well as the currently tried values, when the script is terminated, so it can continue its search later.

Now I saw that there exists a switch -m, which states that it does exactly what I do with my little script. I guess using this switch is a lot faster than calling gperf for a single iteration only. But I need to know two things for replacing the gperf call, which I couldn't find in the gperf help:

  1. Which values if -i and -j are tried if I use the -m switch?
  2. How do I know, which values for -i and -j are actually used, i. e. which are the values leading to the minimum found table lengh for the current gperf call?

Upvotes: 1

Views: 378

Answers (1)

Bruno Haible
Bruno Haible

Reputation: 1292

Which values if -i and -j are tried if I use the -m switch?

You find this info in the source code, lines 1507..1515.

How do I know, which values for -i and -j are actually used, i. e. which are the values leading to the minimum found table lengh for the current gperf call?

You don't need to know. These values are just describing the starting point in gperf's internal path through the search space.

Upvotes: 0

Related Questions