Barrel length and bore diameter affect the volume of the barrel's interior, which is supposed to be ideally matched to the volume of the cylinder. That's it.
As Thundercactus mentions the biggest thing here is bore quality (affects laminar flow and turbulence and such) and hopup quality. Once you've got the BB spinning at the speed you need for proper hop, you want to accelerate it to the correct exit velocity depending on the form factor of your gun.
These aren't rifled barrels with spinning bullets travelling through them, they don't operate on the same principles.
This is all pointless chit chat anyway. Once you've got volume matching and compression figured out, you've got one remaining step to ascend to level 12 onion knight: Install r-hop and a super high quality barrel (eg: prometheus).
You won't experimentally achieve anything better, and nobody (to my knowledge) really has. The rest is speculation.
edit: Oh -- and if you're not using heavy and high quality BBs, there's not much point in discussing this kind of stuff. Any comparison testing (and play, really) should be done on quality 0.28g or 0.3g BBs.
Now you know