Re: [go-nuts] Re: Hashing (u)int8

2016-12-17 Thread Ondřej Kokeš
Good points! I'll keep this in mind!

Thanks again

On Sat, 17 Dec 2016 at 11:32, Damian Gryski  wrote:

> This ends up being only half a megabyte of memory (65536 x 8 byte
> pointers) for the array-based solution.
>
>
>
> You can always write your own hash table, or convert your uint16 key to a
> uint32 for lookup purposes.  (I've done the same thing with floats to speed
> up a float64-keyed hash table.)
>
>
>
> Damian
>
>
>
> --
>
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
>
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/1iSmPQ6vrl0/unsubscribe.
>
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Hashing (u)int8

2016-12-17 Thread Damian Gryski
This ends up being only half a megabyte of memory (65536 x 8 byte pointers) for 
the array-based solution.

You can always write your own hash table, or convert your uint16 key to a 
uint32 for lookup purposes.  (I've done the same thing with floats to speed up 
a float64-keyed hash table.)

Damian

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Hashing (u)int8

2016-12-17 Thread Ondrej
Oh yeah, preallocating 256 elements is fine. It's a bit expensive to 
allocate 2**16 for the int16 case, so I'll have to do with the slow hashing 
there - or are there any plans for speeding up that one?

Cheers, this is helpful.

O.

On Saturday, 17 December 2016 06:15:43 UTC+1, Damian Gryski wrote:
>
> The runtime has optimized map implementations for strings, int32 and 
> int64-sized thing
>
> There is no optimized implementation for int8-sized things -- just use an 
> array.
>
> Damian
>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.