A fast HashSet implementation

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • Go-Utils

    Some parallel and less known but good data structure

    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.

  • go

    The Go programming language

    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.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

  • golangci-lint

    Fast linters Runner for Go

    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).

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts