]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
Remove the tuple reuse optimization in _Pickle_FastCall.
authorAlexandre Vassalotti <alexandre@peadrop.com>
Thu, 28 Nov 2013 22:56:09 +0000 (14:56 -0800)
committerAlexandre Vassalotti <alexandre@peadrop.com>
Thu, 28 Nov 2013 22:56:09 +0000 (14:56 -0800)
commitb13e6bcbd851c61af22c44dbe6f156653f54baae
tree62351f7cb4505e03b848b9d6abd4f0d2112b6407
parentb6e66ebdf76c56b4a893c0687f91d1e6dd9cac2d
Remove the tuple reuse optimization in _Pickle_FastCall.

I have noticed a race-condition occurring on one of the buildbots because of
this optimization. The function called may release the GIL which means
multiple threads may end up accessing the shared tuple. I could fix it up by
storing the tuple to the Pickler and Unipickler object again, but honestly it
really not worth the trouble.

I ran many benchmarks and the only time the optimization helps is when using a
fin-memory file, like io.BytesIO on which reads are super cheap, combined with
pickle protocol less than 4. Even in this contrived case, the speedup is a
about 5%. For everything else, this optimization does not provide any
noticable improvements.
Modules/_pickle.c