Show HN: A LRU cache using go generics
github.com
Show HN: A LRU cache using go generics
1–10 of 14 posts
Re: Show HN: A LRU cache using go generics
#2Re: Show HN: A LRU cache using go generics
#3This is a simple LRU cache I made to get my hands on generics which is available in the go 1.18 beta. Feedback is welcome :-)
Re: Show HN: A LRU cache using go generics
#4This is a simple LRU cache I made to get my hands on generics which is available in the go 1.18 beta. Feedback is welcome :-)
Re: Show HN: A LRU cache using go generics
#5This is a simple LRU cache I made to get my hands on generics which is available in the go 1.18 beta. Feedback is welcome :-)
Might you or anyone else have any good links or references that helped you come up to speed on generics in Go?
Re: Show HN: A LRU cache using go generics
#6You'll probably be a lot better off a) preallocating the elements so your memory is nicely contiguous, b) tracking indices and not pointers. If I wanted to pay 24b overhead per item I'd use an `interface{}`. :)
Re: Show HN: A LRU cache using go generics
#7> Feedback is welcome You'll probably be a lot better off a) preallocating the elements so your memory is nicely contiguous, b) tracking indices and not pointers. If I wanted to pay 24b overhead per item I'd use an `interface{}`. :)
Similar for what you want to preallocate.
Re: Show HN: A LRU cache using go generics
#8> Feedback is welcome You'll probably be a lot better off a) preallocating the elements so your memory is nicely contiguous, b) tracking indices and not pointers. If I wanted to pay 24b overhead per item I'd use an `interface{}`. :)
Which pointer are you wanting to replace, there are a few and I can’t work out which would be best replaced with an int :) (not the author, and not a go developer, just reading through the code and couldn’t work out which you were talking about :) ) Similar for what you want to preallocate.
Re: Show HN: A LRU cache using go generics
#9> Feedback is welcome You'll probably be a lot better off a) preallocating the elements so your memory is nicely contiguous, b) tracking indices and not pointers. If I wanted to pay 24b overhead per item I'd use an `interface{}`. :)
Which pointer are you wanting to replace, there are a few and I can’t work out which would be best replaced with an int :) (not the author, and not a go developer, just reading through the code and couldn’t work out which you were talking about :) ) Similar for what you want to preallocate.
Re: Show HN: A LRU cache using go generics
#10This is a simple LRU cache I made to get my hands on generics which is available in the go 1.18 beta. Feedback is welcome :-)
Might you or anyone else have any good links or references that helped you come up to speed on generics in Go?
https://go.googlesource.com/proposal/+/refs/heads/master/des...