On Tue, 21 Jul 2020 at 06:01, Inada Naoki wrote:
> On Tue, Jul 21, 2020 at 5:07 AM Marco Sulla 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
On Tue, Jul 21, 2020 at 5:07 AM Marco Sulla 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 val
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.
There's also a little
On Sun, Jul 19, 2020 at 6:38 AM Marco Sulla
wrote:
>
> On Sat, 18 Jul 2020 at 10:02, Inada Naoki wrote:
>>
>> On Sat, Jul 18, 2020 at 7:05 AM Marco Sulla
>> wrote:
>> > For what I know, CPython uses PyDictObject for kwargs. Since dicts are
>> > mutable, it's a problem to cache them properly.
>>
On Sat, 18 Jul 2020 at 10:02, Inada Naoki wrote:
> On Sat, Jul 18, 2020 at 7:05 AM Marco Sulla
> wrote:
> > For what I know, CPython uses PyDictObject for kwargs. Since dicts are
> > mutable, it's a problem to cache them properly.
>
> On caller side, Python doesn't use dict at all.
> On callee s
On Sat, Jul 18, 2020 at 7:05 AM Marco Sulla
wrote:
>
> >
> > But when frozendicts are merged?
> > I think there is a very little chance.
>
> frozendicts could be used for kwargs:
>
> f(a=1, b=2)
> # some code
> f(a=1, b=2)
>
> For what I know, CPython uses PyDictObject for kwargs. Since dicts are
On Fri, 17 Jul 2020 at 04:13, Inada Naoki wrote:
> > 3. many python internals uses a mapping proxy to a dict, to avoid its
> > modification. A frozendict can be used instead.
>
> Are they used frequently in performance critical path?
> Could you point some concrete examples?
I searched a little i
On Fri, Jul 17, 2020 at 2:16 AM Marco Sulla
wrote:
>
> On Thu, 16 Jul 2020 at 06:11, Inada Naoki wrote:
> > On Thu, Jul 16, 2020 at 2:32 AM Marco Sulla
> > wrote:
> > > Yes, but, instead of creating a view, you can create and cache the
> > > pointer of a "real" object, that implements the dict v
On Thu, 16 Jul 2020 at 06:11, Inada Naoki wrote:
> On Thu, Jul 16, 2020 at 2:32 AM Marco Sulla
> wrote:
> > Yes, but, instead of creating a view, you can create and cache the
> > pointer of a "real" object, that implements the dict view API.
> > For example, keys for a frozendict could be an "ord
On Wed, 15 Jul 2020 at 08:07, Inada Naoki wrote:
> I don't think so. The view objects are useful when we need a set-like
> operation. (e.g. `assert d.keys() == {"spam", "egg"}`)
Yes, but, instead of creating a view, you can create and cache the
pointer of a "real" object, that implements the dic
On Thu, Jul 16, 2020 at 2:32 AM Marco Sulla
wrote:
>
> On Wed, 15 Jul 2020 at 08:07, Inada Naoki wrote:
> > I don't think so. The view objects are useful when we need a set-like
> > operation. (e.g. `assert d.keys() == {"spam", "egg"}`)
>
> Yes, but, instead of creating a view, you can create an
On Wed, Jul 15, 2020 at 2:01 AM Marco Sulla
wrote:
>
> > Why do you think I do not need views to use the frozendict?
> > I thought that is what make d.key(), d.items() etc work?
>
> Views for dict exist because dict is mutable. See this example:
>
> >>> d = {1: 2}
> >>> keys = d.keys()
> >>> d[2]
On Mon, 13 Jul 2020 at 19:28, Barry Scott wrote:
> > On 13 Jul 2020, at 03:20, Marco Sulla wrote:
> > So why did I try to implement it? IMO, apart the considerations in PEP
> > 416, a frozendict can be useful:
> >
> > - as a faster base for types.MutableMappingProxy
> > - as a substitute of named
> On 13 Jul 2020, at 03:20, Marco Sulla wrote:
>
> TL;DR: I tried to implement in CPython a frozendict here:
> https://github.com/Marco-Sulla/cpython
>
> Long explaining:
>
> What is a frozendict? It's an immutable dict. The type was proposed in
> the past but rejected: https://www.python.or
14 matches
Mail list logo