Digging Geoff Kolbe's book out again, he gives a theoretical optimum barrel length for the .30-06 with 150gn bullet ahead of 53gn IMR-4676 (this load presumably used as the equations involved are based on modifications of those from Homer Powley, the 'father' of modern internal ballistics theories).
Geoff says that bullet-barrel friction is a constant drag while the propellant charge produces variable force diminishing once the bullet passes a certain point in the barrel. (The thing to remember here is that point isn't fixed - it depends primarily on the mix of calibre / case capacity / charge weight / energy content of the powder, so .30-06 gives very different results from .22 LR for instance. We're talking about different 'expansion ratios' here.)
His calculations give 81.5 inches as the theoretical optimum barrel length for the .30-06 load example used where the bullet should attain 3,143 fps MV. But since 90% of that (~2,830 fps) is attained at ~25" barrel length, the conclusion is that barrel length v velocity gives diminishing returns.
The book also gives a barrel length v MV curve for .22LR using a standard velocity cartridge employing c. 1.2gn fast burning powder. Its optimum length for MV is reckoned as 19" (based on experiments done by one Larry Moore published in 'Shooters News', December 1951), but if you look at the curve, it's only marginally rounded between 12 and 28 inches barrel length. This probably explains why subsequent experiments have produced different results since there are so many variations within makes and models of .22LR ammo.
Returning to the .30-06 example, Geoff raises a very important issue / variable that IS affected by barrel length - muzzle pressure as the bullet exits. He considers that reducing that to be the primary reason as why you might choose a barrel length greater than 30" for the .30-06 especially for very long-range shooting. The key point is how much pressure remains in the barrel as the bullet exits - unfortunately, he doesn't give any desirable maximum value to remain within.
The issue here is avoiding, or maybe more accurately minimising, disturbance to and/or inconsistencies in bullet departure behaviours caused by faster moving, escaping gasses overtaking it in its first inch or two of flight. We get around much of this issue by carefully cut muzzle crowns so the pressure is not skewed to one side, but obviously the lower the pressure, the less disturbance imparted, and so much the better.
Using QuickLOAD to obtain some simple examples based on 28" barrels, these are the calculated muzzle pressures for a range of cartridges, all using VarGet for convenience at loads that are calculated to produce maximum allowed chamber pressures:
223 Rem 69 SMK 5,961 psi
6mm BR 107 SMK 6,569 psi
308 Win 155 SMK 6,251 psi
.30-06 155 SMK 7,412 psi
.300 Win Mag 155 SMK 9,234 psi
.300 Rem Ultra Mag 155 SMK 9,600 psi
The two magnums' calculated muzzle pressures rise to over 11,000 psi if you reduce barrel length to 24" as might be seen in a sporting rifle.