This estimates the size, and if we run over it falls back to the
slower python, and similarly if anything happens with the vuints/vints
contained in there, but it still speeds up the typical case
significantly, and improves raw index speed (on cached filesystem
data) by about 14% (~19.7k paths/sec to ~22.5k paths/sec).
Since it doesn't handle corner cases (very long strings or very large
numbers) add a few tests that cover the fallback to python.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Reviewed-by: Rob Browning <rlb@defaultvalue.org>
[rlb@defaultvalue.org: switch to PyMem_Raw*; rename to
limited_vint_pack; use Py_ssize_t with PyTuple_GET_SIZE] Signed-off-by: Rob Browning <rlb@defaultvalue.org> Tested-by: Rob Browning <rlb@defaultvalue.org>