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.

Author serhiy.storchaka
Recipients Olivier.Grisel, alexandre.vassalotti, pitrou, serhiy.storchaka
Date 2018-01-06.18:36:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1515263798.96.0.467229070634.issue32503@psf.upfronthosting.co.za>
In-reply-to
Content
Pickle protocol 4 uses framing for reducing the overhead of calling the read() method for small chunks of data. Most read chunks are small -- opcodes, small integers, short strings, etc, and calling read() for every 1 or 4 bytes is too expensive. But using framing itself adds an overhead. It increases the size of pickled data by 9 bytes. A frame  itself needs 3 reads -- the opcode, the frame size, and a payload. Thus it doesn't make sense to create a frame containing less than 3 chunks of data.

For example after issue31993 pickling the list [b'a'*70000, b'b'*70000] with the Python implementation produces a data containing 3 frames of sizes 3, 1 and 3. Using frames here is completely redundant.
History
Date User Action Args
2018-01-06 18:36:39serhiy.storchakasetrecipients: + serhiy.storchaka, pitrou, alexandre.vassalotti, Olivier.Grisel
2018-01-06 18:36:38serhiy.storchakasetmessageid: <1515263798.96.0.467229070634.issue32503@psf.upfronthosting.co.za>
2018-01-06 18:36:38serhiy.storchakalinkissue32503 messages
2018-01-06 18:36:38serhiy.storchakacreate