On Tue, Jul 21, 2020 at 5:07 AM Marco Sulla <elbar...@gmail.com> wrote:
>
> I just finished to improve the performance of frozendict creation. The result 
> is very promising.
>
> The speedup is about 30% for small dicts (8 items). For large dicts (1k 
> items) is about 38% for dicts with only integers as keys and values, and 45% 
> for dicts with only strings.

Do you mean `frozendict(d)` where d is frozendict?
If so, you don't need to create a new dict. You can just incref the d
and return it.
That is what we do in tuple and frozenset.

> I think the major speedup is due the fact I implemented the solution with a 
> split dict, as suggested by Inada. Even if some of the improvements could be 
> applied to dict too, combined dicts could be more efficient and easy to use 
> for sorting, insertion and deletion.
>

Oh, I don't recommend split dict until you find use case that you can
share many keys.
In general, combined dict is little faster and much efficient.

-- 
Inada Naoki  <songofaca...@gmail.com>
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to