All other factors being equal, a shorter barrel will be more accurate than a longer barrel. Ever notice that benchrest rifles almost all have 20" barrels.
A bicycle wheel is turning the same number of RPM at the axel, as at the wheel, but the distance traveled by the wheel is exponentially greater than the travel at the axel. The same principle applies to rifles also.
The result of ammunition discharges on barrels, are reaction to torque caused by rifling spinning lead projectiles. Twist causes twist, the longer the barrel, the more flex is possible.
Barrel length is a factor only in very long range target applications, IMO. Also in magnum riflery, where you need length to completely burn overbore loads.
Now days, with new mystical powders, Hornaday and Ruger, can claim to exceed factory 375H&H, with that 20" barrel. Good Ole American Voodoo!