logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

resize-hash - (hash)

Description

resize-hash will resize <hash> table (created by new-hash) to size <new size>, which refers to the number of "buckets", or possible hash codes derived from keys stored. When a number of elements stored grows, the search performance may decline if hash size remains the same. Consequently, if the number of elements shrinks, the memory allocated by the hash may be wasted. Use get-hash to obtain its current hash-size, its length (the number of elements currently stored in it) and the statistics (such as average reads) to determine if you need to resize it. Resizing is generally expensive, so it should not be done too often, and only when needed. The goal is to amortize this expense through future gain of lookup performance. For that reason it may be better to resize proportionally (i.e. by a percentage), unless you have a specific application reason to do otherwise, or to avoid exponential growth.

Examples

resize-hash h hash-size 100000

Name

resize-hash - (hash)

Purpose

Resize hash table.

See Also

Hash get-hashnew-hashpurge-hashread-hashresize-hashwrite-hash See all documentation $DATE $VERSION GOLF(2gg)

Syntax

resize-hash <hash> hash-size <new size>

See Also