Barrel length is irrelevant. If the barrel has a 1:12 twist, the bullet will make one revolution for every 12" it travels. Once the bullet has fully engaged the rifling, the rotation is established. If the twist is 1:12, it doesn't matter if the barrel gives one, two or three full revolutions to the bullet before the bullet exits. The bullet receives the same rotation.
Barrel length and velocity are linked, of course.
Target pistols often have longer barrels because of sight radius. Some very sophisticated, very accurate, target pistols do have rather short barrels - the ones with the magazine in front of the trigger are examples of the style. Put a short barrelled pistol in a machine rest, and the actual grouping ability can be determined. Barrel length isn't much of a factor.