Introduce FrozenHashMap. This is space-efficient, non-modifiable HashMap. The relationship is something like, 1. RefCountedArray <-> Vector 2. FrozenHashMap <-> HashMap Idea, 1. For small sized hash-map, we transparently convert it to associative-vector and perform binary searching. 2. For medium / large sized hash-map, we recalculate best-fit-size and make HashTable allocated.
(In reply to Yusuke Suzuki from comment #0) > Introduce FrozenHashMap. This is space-efficient, non-modifiable HashMap. > The relationship is something like, > > 1. RefCountedArray <-> Vector > 2. FrozenHashMap <-> HashMap > > Idea, > > 1. For small sized hash-map, we transparently convert it to > associative-vector and perform binary searching. I'm planning to add lower-tier for HashMap, which is, like, up to 8 elements, we use linear search. But I don't want to make them sorted since this involves many moves. So, for normal HashMap, we just append it in an insertion order, and doing linear search. But once it is converted to FrozenHashMap, we should construct sorted vector and perform binary-search. > 2. For medium / large sized hash-map, we recalculate best-fit-size and make > HashTable allocated.
Created attachment 389771 [details] Patch
Created attachment 389772 [details] Patch
Created attachment 390016 [details] Patch
Created attachment 390017 [details] Patch