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 mstefanro
Recipients alexandre.vassalotti, asvetlov, mstefanro, pitrou
Date 2012-08-22.15:49:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1345650598.98.0.0865781880473.issue15642@psf.upfronthosting.co.za>
In-reply-to
Content
>- I don't really like the idea of changing the semantics of the PUT and GET opcodes. I would prefer new opcodes if possible.

Well, the semantics of PUT and GET haven't really changed. It's just that the PUT opcode is not generated anymore and memoization is done "in agreement" (i.e. both the pickler and the unpickler know when to memoize so their memo tables stay in sync). So, in fact, it's the semantics of the other opcodes that has slightly changed.

>- I would like to see benchmarks for this change.

I've tried the following two snippets with timeit:

    ./python3.3 -m timeit \
                -s 'from pickle import dumps' \
                -s 'd=["a"]*100'
                'dumps(d,3)' # replace 3 with 4 for comparison

    ./python3.3 -m timeit \
                -s 'from pickle import dumps' \
                -s 'd=list(map(chr,range(0,256)))' \
                'dumps(d,3)' # replace 3 with 4 for comparison
                             # you can also use loads(dumps(d,3)) here to benchmark both 
                             # operations at once


The first one generates 99 BINGET opcodes. It generates 1 BINPUT opcode in pickle3 and no BINPUT opcodes in pickle4.
There appears no noticeable speed difference.

The second one generates no BINGET opcodes. It generates no BINPUT opcodes in v4, respectively 256 BINPUT opcodes in v3. It appears the v4 one is slightly faster, but I have a hard time comparing correctly, given that the measurements seem to have a very large standard deviation (v4 gets times somewhere between 32.3 and 44.2, whereas v3 gets times between 37.7 and 52.2).

I'm not sure this is the best way to benchmark, so let me know what is usually used.
History
Date User Action Args
2012-08-22 15:49:59mstefanrosetrecipients: + mstefanro, pitrou, alexandre.vassalotti, asvetlov
2012-08-22 15:49:58mstefanrosetmessageid: <1345650598.98.0.0865781880473.issue15642@psf.upfronthosting.co.za>
2012-08-22 15:49:58mstefanrolinkissue15642 messages
2012-08-22 15:49:57mstefanrocreate