NBPERF(1)

πŸ“¦ version 11.0, in nixpkgs unstable

NBPERF(1) β€” General Commands Manual, but make it group-chat. πŸ’…

🌸 NAME 🌸

okay so nbperf is the icon that computes a perfect hash function for you. No cap, that's the whole vibe.

✨ SYNOPSIS ✨

nbperf [-fps] [-a algorithm] [-c utilisation] [-h hash] [-i iterations]
       [-m map-file] [-n name] [-o output] [input]

πŸ’… DESCRIPTION πŸ’…

Okay bestie, nbperf reads a bunch of keys β€” one per line β€” from standard input or from input. It computes a minimal perfect hash function and writes it to stdout or to output. The default algorithm is "chm".

πŸŽ€ flags & args πŸŽ€

  • -f β€” it appears in the synopsis inside [-fps], but the page doesn't give it its own paragraph. I am not inventing lore for it, periodt.
  • -p β€” seeds the hash function in a stable way. This may take longer than the normal random seed, but it ensures that the output is the same for repeated invocations as long as the input is constant.
  • -s β€” if specified, the generated function will be static.
  • -a algorithm β€” choose the algorithm. Default is "chm". Supported arguments for -a are chm, chm3, and bpz (deets below).
  • -c utilisation β€” sets the parameter utilisation, which determines the space efficiency.
  • -h hash β€” choose the hash. Supported argument for -h: mi_vector_hash β€” platform-independent version of Jenkins parallel hash. See mi_vector_hash(3).
  • -i iterations β€” limits the number of iterations.
  • -m map-file β€” tells nbperf to write the resulting key mapping to map-file. Each line gives the result of the hash function for the corresponding input key.
  • -n name β€” changes the function name to name.
  • -o output β€” sends the result to output.
  • input β€” read keys from this file when it's supplied; still one per line.

🌈 supported args for -a 🌈

  • chm β€” gives you an order preserving minimal perfect hash function. The utilisation must be at least 2, the default. The number of iterations needed grows if the utilisation is very near to 2.
  • chm3 β€” similar to chm, but the resulting hash function needs three instead of two table lookups when compared to chm. The utilisation must be at least 1.24, the default. This makes the output for chm3 noticeably smaller than the output for chm.
  • bpz β€” gives you a non-order preserving minimal perfect hash function. Output size is approximately 2.79 bit per key for the default value of utilisation, 1.24. This is also the smallest supported value.

🧚 supported args for -h 🧚

  • mi_vector_hash β€” platform-independent version of Jenkins parallel hash. See mi_vector_hash(3).

The number of iterations can be limited with -i. nbperf outputs a function matching uint32_t hash(const void * restrict, size_t) to stdout. The function expects the key length as second argument, for strings not including the terminating NUL. It is the responsibility of the caller to pass in only valid keys or compare the resulting index to the key. The function name can be changed using -n name. If the -s flag is specified, it will be static.

After each failing iteration, a dot is written to stderr.

nbperf checks for duplicate keys on the first iteration that passed basic hash distribution tests. In that case, an error message is printed and the program terminates.

If the -p flag is specified, the hash function is seeded in a stable way. This may take longer than the normal random seed, but ensures that the output is the same for repeated invocations as long as the input is constant.

🚦 EXIT STATUS 🚦

The nbperf utility exits 0 on success, and >0 if an error occurs.

πŸ‘€ SEE ALSO πŸ‘€

  • mi_vector_hash(3)

πŸ‘‘ AUTHORS πŸ‘‘

  • JΓΆrg Sonnenberger

xoxo, your NBPERF(1) bestie πŸ’– β€” this page comes from Debian, dated January 5, 2021. (source/version: Debian; date: January 5, 2021; manual: NBPERF(1).) 🫢

πŸ“¦ where this page comes from