【发布时间】:2019-03-20 03:48:28
【问题描述】:
根据 ConcurrentHashMap 中的 java 文档:
* Ideally, the frequency of nodes in bins follows a Poisson distribution
* (http://en.wikipedia.org/wiki/Poisson_distribution) with a
* parameter of about 0.5 on average, given the resizing threshold
* of 0.75, although with a large variance because of resizing
* granularity. Ignoring variance, the expected occurrences of
* list size k are (exp(-0.5) * pow(0.5, k) / factorial(k)). The
* first values are:
问题是:0.5这个参数是怎么来的?
【问题讨论】:
-
我没有这方面的资料,但我确实记得在某处读过它基本上是根据经验观察到的运行的猜测。我猜他们有一堆 CHM 的示例用例,他们认为这些用例很好地代表了“典型”使用,玩弄了一些数字,发现 0.5 似乎效果很好。
-
@yshavit 我想我明白了:看我的答案