Saim Raza
Saim Raza

Reputation: 1460

Why is dill slow?

From https://github.com/uqfoundation/dill/blob/master/dill/dill.py#L43:

from pickle import _Pickler as StockPickler, Unpickler as StockUnpickler

This means dill inherits from pickle._Pickler which is a pure Python implementation. However, _pickle.Pickler is an alternative implementation of pickle and is a much faster version. Why doesn't dill extend from it?

Upvotes: 1

Views: 796

Answers (1)

Mike McKerns
Mike McKerns

Reputation: 35217

I'm the dill author. I made that decision a decade ago, so let's see if I can remember... I believe the reason that dill uses the python pickler over the C pickler is that (a) I wanted dill to be pure python (there were no wheels, so distributing code with C extensions was less trivial) and (b) I wanted to be able to hijack the pickle registry so import dill would populate objects into the pickle registry. I think that's the rationale.

Upvotes: 5

Related Questions