bp burns slowly so if you want velocity you need length. I had an old, beat up cva .50 that I experimented with using my chronometer. after 80 gr ffg there was no improvement in velocity and at 90 the velocity began to drop ( pushing powder that burns outside the barrel just adds weight so it slows down) my 10 inch longer rifle (same 1:48 twist, same patch and ball) increased velocity up to 98gr
Additionally, the longer sight radius on a longer barrel makes picking up imperfections in the sight picture much easier.
Years ago I had a dan wesson pistol pack ( a stainless.44mag with 4”,6”,8” barrels and shrouds an extra grip and barrel tool all in a fitted briefcase) and a guy was yapping that short barrels are inherently inaccurate. I tried to explain than the short sight radius is the problem, not the length. He wanted to bet so i dragged out my ransom rest (with the extra heavy springs as muzzle whip is considerable in a 4” .44mag). Lo and behold, all 3 barrels tuned in nearly identical groups ( the longer barrels printing higher due to greater velocity). Made $190 ($200 bet -$10 of ammo).