Velocity also plays a part in optimum barrel twist.
Excessive twist will raise pressure, and can destabilize a bullet. I have a friend that would load his 6mm rifle so hot the bullets would spin apart as they left the barrel.
So heavy slow bullets need a faster twist than light fast bullets. But then you throw in length of the bullet and you get all screwed up!
Why S&W has such a slow twist is beyond me, but it works. Or maybe it doesn't and we never notice because we don't shoot very far.
See this article which has a twist rate formula and some good information by Chuck Hawks.
RIFLE BARREL TWIST RATES