Speed-up path element operations & comparisons

Avoid repeated expensive operations in `STPathElement` (e.g. calls to `base_uint::isZero`) and attempt to make comparisons of path elements faster by calculating a path id and using it to avoid expensive comparisons between `base_uint` objects.

This is pending a performance review.
I don't have cold, hard facts. I did a quick bit of calculations, given that `std::map::insert` is logarithmic in the size of the map, then for an array with `n` items the construction of the map will take `O(Γ(n+1))` so that's a bit of a disappointing start.

It is my intuition, however, that eliminating the inner loop makes up for that: the existing code does `m` iterations of the internal loop and for each one can do up to `n` iterations of the internal loop: `O(m*n)`. The modified code however, does `O(m*log(n))` work inside the loop - automatically better. It's total runtime is `O(Γ(n+1)) + O(m*log(n))` which is still better.

Using an `std::unordered_map` could improve that analysis further (if you stick to "average" runtime complexities) but I don't that it matters much.

Ultimately, I just don't know if this hurts or helps: it needs to be tested.