Improve performance of `IdGenerator.EnhancedDoubleHashGenerator`
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 211
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 89
Description
In https://github.com/apache/incubator-pekko/pull/371 `IdGenerator.EnhancedDoubleHashGenerator` was added and in order to make it thread safe we used the simple solution of adding the `synchronized` keyword (see https://github.com/apache/incubator-pekko/blob/f6930d93da4504590b37ed2c4bc35bdc30e127c3/actor/src/main/scala/org/apache/pekko/io/dns/IdGenerator.scala#L73). While this is was a practical and convenient solution at the time (largely because we don't expect much contention on `IdGenerator.EnhancedDoubleHashGenerator` along with time constraints due to needing to push out a release), as @alexandru rightly pointed out in https://github.com/apache/incubator-pekko/pull/371#issuecomment-1592917793 `synchronized` is rarely (if ever) the most optimal solution for any given concurrency problem.
Contributor guide
Assessment
This issue has not been assessed yet.