Optimum barrel weight for maximum velocity? Most most types of ammo, yes it has been said it is around 16 inches. I've read actual tests done in another forum.
For hyper velocity, light bullet ammo, maybe longer barrel is required for complete powder burn to obtain max velocity from a particular cartridge.
For accuracy?
This would be an interesting test, if somebody would undertake it, starting with say 26 inches and chopping one inch at a time done to say, 12 inches.
Scoped and benched/sandbagged, or if there was a mechanical rest for rifles similar to the Ransom Rest for handguns. I guess every popular brand and cartridge model/typel would have to be tested to come up with some meaningful data.
For iron sights, the longer barrel would offer longer sight radius and therefore better accuracy potential.
Target rifles with peep sights have around 25 inches of barrel. I suppose accuracy takes precedence over velocity in this case.