Some optimizations for ring rebalancing.

For a part-power 18 ring with a small number of devices (12), this drops
"swift-ring-builder ... rebalance" from ~7.2 seconds to ~3.6s on OS X
with Python 2.7 (2.7 GHz i7 processor).

Under the profiler, that part-power 18 rebalance now spends only
slightly more time rebalancing the ring than it does writing out the
results.

I haven't done more extensive before/after comparison with larger
numbers of devices and larger part-power values...

Change-Id: I25735bc71da2f11617cc436d4f8e0c4f3f82bfec
Merge "Some optimizations for ring rebalancing."