Re: Efficient HV fetches without recomputing the key hash
[email protected] (Michael Conrad) Wed, 13 May 2026 16:08:13 -0400
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
On 5/13/26 1:42 PM, Paul "LeoNerd" Evans wrote: > The HV API is a bit of a mess of functions. There's basically two ways > you can look up an item out of an HV, depending on how you have your > ... > ... > That really ought to > have been a `U32 flags`, which could then be used to contain a bunch of > different behaviours... but eh. It's a bit late now to start fixing all > of these things... My biggest gripe about hv_fetch and hv_store are that they expose the "returns NULL if hash is tied, meaning it didn't actually take ownership of your SV reference" behavior at every single call site. I don't think it's too late at all to create a new HV get/set API for XS code, it just needs to go into ppport.h and then we get to use it everywhere. -Mike C.