NBPERF(1)
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 bestatic.-aalgorithm β choose the algorithm. Default is"chm". Supported arguments for-aarechm,chm3, andbpz(deets below).-cutilisation β sets the parameterutilisation, which determines the space efficiency.-hhash β choose the hash. Supported argument for-h:mi_vector_hashβ platform-independent version of Jenkins parallel hash. Seemi_vector_hash(3).-iiterations β limits the number of iterations.-mmap-file β tellsnbperfto write the resulting key mapping tomap-file. Each line gives the result of the hash function for the corresponding input key.-nname β changes the function name toname.-ooutput β sends the result tooutput.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 least2, the default. The number of iterations needed grows if the utilisation is very near to2.chm3β similar tochm, but the resulting hash function needs three instead of two table lookups when compared tochm. The utilisation must be at least1.24, the default. This makes the output forchm3noticeably smaller than the output forchm.bpzβ gives you a non-order preserving minimal perfect hash function. Output size is approximately2.79bit 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. Seemi_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
- nixpkgs unstable: nbperf-netbsd 11.0
- Copyright (c) 2009 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms