Closed efulmo closed 1 year ago
Unless you specifically ask the API for a “thread-safe” set using the appropriate constructor methods you will get a Set type back that is not thread safe. In other words it does not use any locking internally and this means you don’t have to worry about taking an unnecessary performance hit with respect to synchronization.
It’s up to you and your application design to use the appropriate constructor method. If you don’t need synchronization just use the NewSet
related methods and if you do, use the NewThreadSafe
related constructor methods.
There are only two choices and knowing which to use is only something you can answer.
The README mentions there are 2 implementations that share the same interface. It's unclear though:
NewSet[T]()
?mapset
used as a default module name in samples?set
seems much more straightforward.