If you are talking what is "historically" correct, many flintlocks had 38-46 inch length barrels...I have 2 flinters, one a 1770 era and one a 1820 style, the earlier one has a 38 inch barrel, the later a 42 inch barrel...During that time frame most muskets also had a longer barrel, in the case of a musket its just as likely that they were that long because of the use of a bayonet, it gave you more reach...In a rifle's case the longer barrel gives you a longer sight radius, which should make you more accurate...But if you look at the German Jaeger rifles made, most of them were shorter than the typical American Longrifle...
Some as short as 24 inches or so, since the Germans started rifling wheelocks and matchlocks in the mid 1500s, I expect they knew they were losing some velocity, but remember with a heavy .54-62 caliber ball, you don't need the high velocity that we strive for today in modern cartridges...Whether you have, say 1600fps at the muzzle or 1500fps really does not matter in shooting a lead ball of that size...And with open sights in a hunting situation, 100-150 yards is about as well as most guys can shoot anyway, so flat trajectory isn't as important.
Velocity gained could be part of it, the powder we have now is certainly better than what they had especially during the American Revolution...But I feel that much of it is style, like the octagon barrels.