GOLF(2gg)
π GOLF(2gg) π
okay bestie, welcome to the Golf manual, gg edition π this one's all about new-hash, and no cap, it's a little cutie.
β¨ NAME β¨
new-hash β the hash-maker (it's giving "hash" energy, fr fr) π¦
π― PURPOSE π―
Create hash. That's it. That's the whole vibe. Slay. π
π SYNTAX π
new-hash <hash> \
[ process-scope ] \
[ hash-size <hash size> ]
likeβ¦ look at her. gorgeous. β¨
πΈ DESCRIPTION πΈ
so new-hash creates a new <hash>. and what even is a hash, you ask? bestie. a hash is a collection of key/value pairs β those are called "elements" β and you get a value of an element based on its key value. that's the whole deal. iykyk π
π SCOPE π
okay this part matters, so listen up π
a hash is accessible to the current request onlyβ¦ unless you use the process-scope clause, in which case all requests served by a process can use it. (peep do-once for a typical way to create a hash with a process scope, bestie π«Ά)
if you do use process-scope, then <hash> will keep its data across all requests in a given process. and yes, write-hash has an example of a process-scoped hash if you wanna see it in the wild. π
π SIZING A HASH π
a hash can be any size, as long as there's enough memory for it. simple as that.
the hash-size refers to the size of a hash table used to provide high-performance access to its elements based on a key. basically: how big is the shelf we're putting stuff on ποΈ
<hash size> is the number of "buckets" used by the hash (it is 10 by default, lowkey tiny but it's the default, periodt). all hash elements with the same hash code get stored in a linked list within the same bucket. so a greater <hash size> generally means less elements per bucket and better performance π₯
however β and this is the part where we stay humble β memory usage grows with a bigger hash table. so <hash size> should be balanced based on the program needs. it's giving "treat her right, don't go feral" energy π
Golf uses the high-performing FNV1_a hash algorithm, iconic behavior tbh. each element in a bucket list is lightweight β it contains pointers to a key, a value, and the next element in the linked list. so smol. so efficient. we love her π
β οΈ <hash size> must be at least 256. if less, it will be set to 256. no negotiating, bestie, the algorithm said what it said π
π« EXAMPLES π«
create a new hash with 5000 buckets:
new-hash h hash-size 5000
and if you want more examples, go check out read-hash β she's got the receipts π
π SEE ALSO π
- Hash
get-hashnew-hashpurge-hashread-hashresize-hashwrite-hash- See all documentation
and that's the whole page, bestie π«Ά go forth and hash responsibly. this was the GOLF(2gg) page, version $VERSION, dated $DATE β mwah, take care of her πβ¨
π¦ where this page comes from
- ubuntu questing: golf 601.4.41-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms