You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Pickle 32-bit integers with protocol 0 as INT instead of LONG #76218
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/serhiy-storchaka'closed_at=<Date2017-11-16.07:45:07.353>created_at=<Date2017-11-15.16:59:49.683>labels= ['3.7', 'type-feature', 'library']
title='Pickle 32-bit integers with protocol 0 as INT instead of LONG'updated_at=<Date2017-11-16.07:45:07.352>user='https://github.com/serhiy-storchaka'
In Python 3 different opcodes are used for pickling integers with protocol 1 and higher. But pickling with protocol 0 always uses the LONG opcode. In Python all such integers are unpickled to the long instances.
Proposed PR makes integers that fit in a signed 32-bit integer be pickled with the INT opcode. This will decrease the size of a pickle (minus one byte 'L' per integer), speeds up pickling and unpickling, and makes these integers be unpickled to int instances in Python 2, that will save a memory.
New changeset 3daaafb by Serhiy Storchaka in branch 'master': bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (bpo-4407) 3daaafb
Activity
serhiy-storchaka commentedon Nov 15, 2017
In Python 3 different opcodes are used for pickling integers with protocol 1 and higher. But pickling with protocol 0 always uses the LONG opcode. In Python all such integers are unpickled to the long instances.
Proposed PR makes integers that fit in a signed 32-bit integer be pickled with the INT opcode. This will decrease the size of a pickle (minus one byte 'L' per integer), speeds up pickling and unpickling, and makes these integers be unpickled to int instances in Python 2, that will save a memory.
serhiy-storchaka commentedon Nov 16, 2017
New changeset 3daaafb by Serhiy Storchaka in branch 'master':
bpo-32037: Use the INT opcode for 32-bit integers in protocol 0 pickles. (bpo-4407)
3daaafb