java 中的字符串池是如何根据桶来衡量的
How is string pool measured in terms of buckets in java
在阅读有关字符串池及其多年来变化的 this 文章时,我遇到了以下语句:
Prior to Java 7u40, the default pool size was 1009 buckets but this
value was subject to a few changes in more recent Java versions. To be
precise, the default pool size from Java 7u40 until Java 11 was 60013
and now it increased to 65536.
那么,字符串池中的桶是什么?这些与驻留字符串的数量有何可比性?这个概念是不是类似于hashmaps中的bucket?
So, what are buckets in String pool?
String池基本是a hash table。哈希 table 包含 buckets 或 slots.
How are these comparable to the number of interned Strings?
它是 implementation-defined (JVM-specific) 并且取决于单个存储桶存储的条目数。理想情况下,一个桶保留一个条目。
Is the concept similar to buckets in hashmaps?
是的,是一样的想法。
Why is the default pool size growing? (my question)
分配的桶越多,获得的 the load factor 越低,这对性能有积极影响。我猜 table 中占用的初始条目数会增加,因此保持更新负载因子很重要(至少保持在同一水平)。
在阅读有关字符串池及其多年来变化的 this 文章时,我遇到了以下语句:
Prior to Java 7u40, the default pool size was 1009 buckets but this value was subject to a few changes in more recent Java versions. To be precise, the default pool size from Java 7u40 until Java 11 was 60013 and now it increased to 65536.
那么,字符串池中的桶是什么?这些与驻留字符串的数量有何可比性?这个概念是不是类似于hashmaps中的bucket?
So, what are buckets in String pool?
String池基本是a hash table。哈希 table 包含 buckets 或 slots.
How are these comparable to the number of interned Strings?
它是 implementation-defined (JVM-specific) 并且取决于单个存储桶存储的条目数。理想情况下,一个桶保留一个条目。
Is the concept similar to buckets in hashmaps?
是的,是一样的想法。
Why is the default pool size growing? (my question)
分配的桶越多,获得的 the load factor 越低,这对性能有积极影响。我猜 table 中占用的初始条目数会增加,因此保持更新负载因子很重要(至少保持在同一水平)。