I did have a look at hash/maphash, but I didn't think it was the right 
shaped API for what I am doing.  In short, I would have to contrive to 
provide words to the package as byte slices, which then would turn them 
back into words under the hood.  That feels like a superfluous round trip, 
given that the table is at the heart of everything in Lua as it is the only 
data structure available (so it is used to implement objects, modules, 
namespaces...).  I haven't discarded it yet but I wanted to explore other 
possibilities before doing some benchmarking.

Arnaud

On Thursday, 24 December 2020 at 10:45:30 UTC axel.wa...@googlemail.com 
wrote:

> On Thu, Dec 24, 2020 at 11:19 AM Arnaud Delobelle <arn...@gmail.com> 
> wrote:
>
>> Does that sound like a sensible approach?  I.e. is it safe enough to use 
>> the go:linkname directive, and do those seem like the right functions to 
>> call to obtain a good hash?
>>
>
> It is probably better to use hash/maphash, if you can.
> https://golang.org/pkg/hash/maphash/
> It's the intended use-case for that package and not subject to changes in 
> the runtime. However, the downside is that it doesn't allow all the same 
> values to be used as keys as Go maps do (you have to do the mapping from 
> values to []byte manually), so it might not be suitable.
>  
> Personally, I feel that go:linkname and similar trickery is too much black 
> magic to actually use. But TBF, I might be too biased on cleanliness over 
> performance and other concerns.
>
>
>> TIA
>>
>> -- 
>> Arnaud
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/79e3f124-037c-4c10-a7b6-42f496bd26b6n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/golang-nuts/79e3f124-037c-4c10-a7b6-42f496bd26b6n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/53df26d1-cacc-48ed-9355-38dd46cddef4n%40googlegroups.com.

Reply via email to