oklog / ulid

Universally Unique Lexicographically Sortable Identifier (ULID) in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use init() instead of sync.Once to initiate default entropy

ivanjaros opened this issue · comments

In the DefaultEntropy you are using sync.Once to initiate the entropy and new reader. This means that every call to Make() has to make atomic call to see if sync.Once has been invoked. This seems very pointless when you could have simply used init(), which is run only once, and poses no performance hit. Especially when this is not ephemeral code but rather eternal and called many many many times.