Just FYI, Jim Carmichael did a test on this back in the 1970s sometime. IIRC, he came up with 16" being the ideal for velocity but standard deviation was high; 19" gave the most consistent velocity; and after 21" of barrel length there was a net velocity loss. Pressure measurements showed that a 22LR cartridge developed maximum pressure before the bullet had completely exited the case, and pressure dropped consistently after 2" of travel. Your tests show a very similar scenario, with a 5" handgun giving 80% of the velocity possible from a rifle barrel.
Years ago, 22LR rifles were common with 24"-26" barrels, but longer barrels give a longer sight radius which contributes to shooter accuracy. With optical sights being the norm nowadays, there is no reason why you should not have a shorter than 20" barrel.