Stefan Mihaila added the comment:
>- 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.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue15642>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com