Re: [go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread roger peppe
If it's hard to make a perfect hash function, and assuming you don't need modification after initialisation, you could use struct {keys []uint32; vals []uint64}, sort the keys and their associated values, then binary search. By storing keys and values in different slices, you save 25% space

Re: [go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread Jan Mercl
On Mon, Jul 24, 2017 at 5:32 PM il wrote: > Can you help me best solution? Create a perfect hash function in 28 bits. Use a [1<<28]T array for the map values. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] How make fastest map[uint32]uint64 with fixed size(250m)?

2017-07-24 Thread il
I have task: 1. Initialize map(250 million items) 2. Fill all values 3. Start http server. 4. Process requests. Iterates all values. I need fast "for" and read access with reasonable memory consumption. This is very important. Can you help me best solution? Thank you! -- You received this