@Ionus,
Well, yes. Too long a barrel will finally slow it down to internal friction. Are you talking about a 90 inch long barrel? And sure, some powers are made for short barrels. .25 ACP pocket pistol uses a cartridge designed exclusively for extremely small pocket pistols. In spite of published ballistics it has much better energy and velocity that the .22 in essentially the same gun. We're not talking about 2" or 90" barrels.
If you don't want to allow a little generalization, quit talking about taking gas off for the cocking mechanism. This sounds much like the gas port in a military weapon and doesn't apply with bolt action, falling block, or blowback designs.
In general, longer barrels give higher velocities. We can make up exceptions all day long.