Message300163
> I like idea.
> One worrying point is how to deal with dirty dict.
> How about do it only when ma_used == keys->dk_nentries?
I've added this check. See the updated PR.
> The PR changes the behavior. Currently the effect of copying is compacting the dict.
The check that INADA suggested enables compacting on copy, if it is needed.
> The PR adds over 50 lines of code for optimising not very often used feature.
I started to look into the problem because I need this for my upcoming PEP, so please don't dismiss this idea right away.
I also think that copying a dict isn't a "not very often used feature", it depends on your frame of references. In some applications you do copy dict a lot. 50 lines of code speeding up one of the core methods 5.5x is a fair price to pay.
> There are two obvious ways of copying, dict(d) and d.copy()
That can also be easily optimized, btw. I'll see if I can do that without impacting the performance of creating new dicts.
> The PR duplicates the low-level code, that increases maintainability cost.
FWIW, the PR doesn't duplicate any of the code. It provides a new implementation that is more efficient than the old approach. |
|
Date |
User |
Action |
Args |
2017-08-11 14:48:01 | yselivanov | set | recipients:
+ yselivanov, rhettinger, vstinner, methane, serhiy.storchaka |
2017-08-11 14:48:01 | yselivanov | set | messageid: <1502462881.73.0.0978090415954.issue31179@psf.upfronthosting.co.za> |
2017-08-11 14:48:01 | yselivanov | link | issue31179 messages |
2017-08-11 14:48:00 | yselivanov | create | |
|