40 grains of Reloder 15 (a slower powder) gets 2362 fps from the 22 inch barrel...
2412 fps from the 24 inch barrel
Twist rate, groove/land configuration, throat condition, fouling, and a myriad of other factors contribute to a given barrel's ability to achieve a certain velocity with a specific load. Unless you're comparing two identical rifles (save for barrel length) from the same production run for the barrel - you're comparing apples to tangerines.
As a general rule, you will continue to gain velocity well past 26" in most any rifle chambering. However, the differences will be diminishing, and in exchange for a longer barrel and incremental velocity gains comes a definite decrease in rifle portability and a very likely decrease in overall accuracy.
Shorter barrels of a given contour from a given manufacturer are GENERALLY more accurate than longer but otherwise identical barrels. Longer barrels from a given manufacturer are GENERALLY faster than shorter ones.
In 308, I have seen experiments that indicated that the return on length past 16" is somewhere between 25fps and 40fps per inch.
Many folk that shoot 308 at extended distances seem to feel that 24" in a heavy contour (for stiffness) is a good length. It's not really useful for offhand shooting, though. For offhand shooting, most folk seem to prefer a 20" barrel and sacrifice a little velocity loss in exchange for better handling in the field.
It all depends on what you want to do.