-
HashSet is a hash set implementation based on the open-addressing algorithm hopscotch hashing. The motivation for using HashSet[E comparable] over using type Set[E comparable] map[E]struct{} is mainly due to the improved speed and memory usages. It uses internal hash functions exported from runtime. Originally, I used hash/maphash, but this proved to be very slow(at least on my end) compared to the private hash functions used by native map in package runtime.
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
I recommend writing more thorough benchmarks as in https://github.com/golang/go/blob/master/src/runtime/map_benchmark_test.go. Currently your implementation only benchmarks the basic cases -- which, of course, is fine if that's all the cases you need to support. If you mention a disadvantage, then I would expect to see that in the benchmark.
-
All of this is nitpicking really, but I would suggest using linters, e.g. https://github.com/golangci/golangci-lint - sometimes annoying, but mostly just helps to avoid discussions like this (and plethora of bugs).