It depends if you are talking Pneumatic, or Springer. If a springer, there will be very little change. Sometimes even improving in velocity if coming down from 18 inches to 12 inches. The minimum to go is 11 inches as a reduction in power starts around 10 inches.
With Pneumatics you will get a big reduction. Most barrel mods (lengthening) on Crosman pistols. or single stroke, usually see 25fps per inch increase (very roughly gun dependent) On PCP rifles, short carbine versions see a big reduction in shot count for the gun to make the same power, meaning they must dump more high pressure air per shot to make the same power in short barrel versions.
The only time i have seen springer guns improve for having longer barrels is in the case of air pistols with decent size power plants, where their barrels are not quite long enough to make the most from that power plant. A good example being the old BSA Scorpion pistol, where the 18 inch barrel version for the Buccaneer air rifle (shared power plant) would make a bit more over the shorter barrellled pistol. ….Trimming it back to 11 inches long made even more ….suggesting an optimum of 11 to 12 inches for this gun. The HW45/P1 will also gain a bit up to a point…approx 9 inches before nothing else is gained.