Speed optimizations in MutableChain.prepareSwap.