Barrel length comes a very distant second to barrel quality. By that, i mean smoothness of the bore, uniformity of bore ID, condition of the crown etc...
I've owned very accurate rifles with 16", 18", 24" and 28" barrels, and equally not-so-accurate rifles with 16", 18" and 20", so in my mind length is a relatively irrelevant factor in the real world, especially in regards to .22lr.
It will affect how you balance and steady the gun, It will affect the weight and as mentioned it may work better with sights or a scope depending on length. It will also affect the volume of the report coming from the muzzle. All matters of personal preference.
My personal preferred length is 18" because of esthetics and the feel of the rifle and the way it points.