GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) β€” get-hash πŸ’–

okay bestie, welcome to the GOLF(2gg) manual, section Development, and today's main character is get-hash 🫢


✨ NAME ✨

get-hash β€” (hash)

🎯 PURPOSE 🎯

Get usage specifics for a hash. that's it, that's the whole vibe πŸ’…

πŸŽ€ SYNTAX πŸŽ€

get-hash  <hash > \
    ( length <length> ) \
    | ( hash-size <hash size> ) \
    | ( average-reads <reads> )

🌸 DESCRIPTION 🌸

so get-hash gives you the usage specifics of a <hash> β€” and like, a hash that was created by new-hash, obviously. iykyk πŸ’–

Use the length clause to obtain its <length>, which is literally the number of elements stored in it. then there's the hash-size clause, which gets you its <hash size> β€” that's the number of "buckets", aka the possible hash codes in the underlying hash table. buckets!! πŸͺ£βœ¨

The average-reads clause will obtain, in <reads>, the average number of reads β€” meaning how many string comparisons are needed on average to find a key β€” multiplied by 100. so if the average number of reads was 1.5, it will be 150. no cap, it just does that πŸ“

This info is lowkey useful for determining the performance of a hash, and for figuring out whether resize-hash is indicated. like, vibe check your hash before you start resizing things πŸ‘‘

πŸ¦‹ EXAMPLES πŸ¦‹

get-hash h length l hash-size s average-reads r

πŸ‘‘ SEE ALSO πŸ‘‘

Hash

get-hash new-hash purge-hash read-hash resize-hash write-hash

See all documentation


k byeee bestie πŸŽ€ this iconic little page is from $VERSION, dated $DATE, and it lives in GOLF(2gg) β€” periodt πŸ’…πŸŒˆβ­

πŸ“¦ where this page comes from