Pickle vs JSON — Which is Faster in python3 ?

Mishraarvind
1 min readApr 4, 2020

--

short answer — pickle serialization is much faster, over 66% faster than JSON serialization on python 3.8.2

python 3.8

python38 introduced a lot of improvements in the pickle module. The other day I was reading a stack overflow question on which serialization is faster -JSON or pickle, and down the rabbit hole, I came across a blog of Konstantin. https://github.com/kovshenin. I went ahead and saw the code, which btw is nicely annotated, you should go and check out on his repo. Since python38 introduced a lot of new features include the new protocol for the pickle library lets try and see the performance.

So pickle serialisation is faster by a wide margin. As you see JSON serialisation takes 3.852 sec and pickle serialisation takes only 2.5308 sec. The margin grows even larger.

--

--