For woods range cartridges (200 yard or less shooting) such as the 30-30, 35 Rem a 20 inch barrel will work great and keep the rifle handy.
I believe that for standard high velocity chamberings in the 270 Wnchester, 30-06, .308, 7mm-08 range you will be fine with a 22 inch barrel. That gets almost all the speed out of those rounds that you'll acheive and keeps a rifle pretty trim.
For the short action magnum calibers (WSM family, SAUM family) and larger calibers in the 338-35 range a 24 inch barrel is good. 24 inches is also good for any necked down versions of the 30-06- i.e. the 25-06.
For large magnum calibers such as the 7mmSTW, 257 Weatherby Mag, 7mm Ultramag, 300 Weatherby Mag a 26 inch barrel is better.
I believe that with most high velocity calibers in the 30-06, 270 class you lose only about 75-100 fps per inch of barrel reduction.
There are super short barreled carbines with 18 inch barrels like the Ruger compact M77, and those are ok in a lighterweight caliber like 7mm-08, or 257 roberts, 243 Win., but I wouldn't want to shoot one frequently in anything bigger.