[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread INADA Naoki

Changes by INADA Naoki :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 46e329ef13ae by INADA Naoki in branch '2.7':
Issue #29019: Fix dict.fromkeys(x) overallocates when x is sparce dict.
https://hg.python.org/cpython/rev/46e329ef13ae

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread INADA Naoki

INADA Naoki added the comment:

While the patch is trivial, I need LGTM from another comitter.

--
stage:  -> patch review
Added file: http://bugs.python.org/file45974/fromkeys2.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread INADA Naoki

INADA Naoki added the comment:

Since `seq` is checked by PyDict_CheckExact(seq) already,
((PyDictObject*)seq)->ma_used may be better.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +inada.naoki

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29019] dict.fromkeys overallocates when given a sparse dict

2016-12-19 Thread Rasmus Villemoes

New submission from Rasmus Villemoes:

Somewhat related to #23971, but with the opposite sign: Using Py_SIZE on a 
PyDictObject gives the ma_fill member in 2.7 (and until 3.2 AFAICT), not the 
ma_used member. So calling dict.fromkeys(d) overallocates significantly if a 
lot of elements have been deleted from d.

The fix is trivial, though one could of course avoid the function call and do a 
cast. Not sure this qualifies for 2.7, though.

--
components: Interpreter Core
files: fromkeys.patch
keywords: patch
messages: 283654
nosy: villemoes
priority: normal
severity: normal
status: open
title: dict.fromkeys overallocates when given a sparse dict
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file45973/fromkeys.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com