Issue 19754: pickletools.optimize doesn't reframe correctly (original) (raw)

Issue19754

This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/63953

classification

Title: pickletools.optimize doesn't reframe correctly
Type: resource usage Stage: resolved
Components: Versions: Python 3.4

process

Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: alexandre.vassalotti Nosy List: alexandre.vassalotti, pitrou, python-dev, serhiy.storchaka, tim.peters
Priority: low Keywords:

Created on 2013-11-24 13:29 by pitrou, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg204213 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-11-24 13:29
pickletools.optimize() can output arbitrarily large frames (much larger than then 64 KB heuristic). This may be annoying for memory use when pickling -- on the other hand if you keep the whole pickle in memory for optimize() perhaps it's not a problem keeping it in memory for load() :-) $ ./python -c "import pickle, pickletools; d = pickle.dumps(list(range(100000)), 4); pickletools.dis(d)" | head 0: \x80 PROTO 4 2: \x95 FRAME 65537 11: ] EMPTY_LIST 12: \x94 MEMOIZE 13: ( MARK 14: K BININT1 0 16: K BININT1 1 18: K BININT1 2 20: K BININT1 3 22: K BININT1 4 $ ./python -c "import pickle, pickletools; d = pickle.dumps(list(range(100000)), 4); pickletools.dis(pickletools.optimize(d))" head 0: \x80 PROTO 4 2: \x95 FRAME 368875 11: ] EMPTY_LIST 12: \x94 MEMOIZE 13: ( MARK 14: K BININT1 0 16: K BININT1 1 18: K BININT1 2 20: K BININT1 3 22: K BININT1 4
msg204235 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-11-24 16:39
> on the other hand if you keep the whole pickle in memory for optimize() perhaps it's not a problem keeping it in memory for load() :-) This is not always true. You run optimize() on one computer or environment and load() on other.
msg204981 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-12-02 00:28
New changeset bb71baa28f1b by Alexandre Vassalotti in branch 'default': Issue #19754: Make pickletools.optimize respect the frame size target. http://hg.python.org/cpython/rev/bb71baa28f1b
msg204982 - (view) Author: Alexandre Vassalotti (alexandre.vassalotti) * (Python committer) Date: 2013-12-02 00:28
Now, pickletools.optimize doesn't do anything on protocol 4. :)
msg204983 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-12-02 00:32
New changeset 9feada79a411 by Alexandre Vassalotti in branch 'default': Issue #19754: Fix typo. http://hg.python.org/cpython/rev/9feada79a411
History
Date User Action Args
2022-04-11 14:57:54 admin set github: 63953
2013-12-02 00:32:00 python-dev set messages: +
2013-12-02 00:28:56 alexandre.vassalotti set status: open -> closedmessages: + assignee: alexandre.vassalottiresolution: fixedstage: resolved
2013-12-02 00:28:02 python-dev set nosy: + python-devmessages: +
2013-11-24 16:39:15 serhiy.storchaka set nosy: + serhiy.storchakamessages: +
2013-11-24 13:29:04 pitrou create