Improve speed of py-libzfs when retrieving many datasets or snapshots
Currently py-libzfs is extremely slow with a huge set of datasets or snapshots
It can be compared with CLI version:
"zfs get -t filesystem all"
"[i.__getstate__() for i in libzfs.ZFS.datasets]"
"zfs get -t snapshot all"
"[i.__getstate__() for i in libzfs.ZFS.snapshots]"
I suspect thats because we are retrieving each nvlist at a time and and building the python object for it.
We need the investigate if that can be optimized. One idea is to try and grab a chunk of nvlist at once (pure cython code, not mixed with python, and transform it later).
Another idea would be to serialize all of the ahead in pure cython (or even C) and only convert to python at the final stage, since when most of the times when we want a list of all datasets/snapshots we will only need it serialized anyway.