[issue20774] collections.deque should ship with a stdlib json serializer

Ken Jin report at bugs.python.org
Thu Nov 5 10:47:24 EST 2020


Ken Jin <kenjin4096 at gmail.com> added the comment:

Sorry to butt into this conversation, but I wanted to add that I have interest in this feature - deques are the fourth most common container types I use in Python. Is there any way I can help to get this PR across the finish line?

So far I've forked the PR, rebased it, then applied some changes (docs, news, and performance) to try to lessen the impact of checking for deque:

(Python/master branch)
>>> timeit.timeit(stmt="json.dumps(['test'])", setup="import json", number=1_000_000)
2.2583862999999997

>>> timeit.timeit(stmt="json.dumps(10000)", setup="import json", number=1_000_000)
1.9845121999999975

(Python/pr_830 branch)
>>> timeit.timeit(stmt="json.dumps(['test'])", setup="import json", number=1_000_000)
2.324303399999991

>>> timeit.timeit(stmt="json.dumps(10000)", setup="import json", number=1_000_000)
1.9680711999999971

The PR branch is here https://github.com/Fidget-Spinner/cpython/tree/pr_830.

I'm not a Git wizard, so I don't know what's the best next step. Do I 
a. Make a PR against Lisa's PR (or)
b. Make a brand new PR against cpython master ?

If the core devs here feel that after 6 years, this change might be unneeded after all, I don't mind closing the branch either. Thanks for reading.

----------
nosy: +kj

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue20774>
_______________________________________


More information about the Python-bugs-list mailing list