I've shot the .22 WMR for a couple decades. IMHO, 26" is past the point of diminishing returns. 20" is fine. There was an article in one of the gun mags a few years back which, if memory serves (and as Grand has indicated) concluded that optimal length was 20-21"
I always enjoy discussions about shooting and the real potential of rimfire rounds. My interest and research led me to Dr. Mark White who owns Sound Technology, and has spent many years exploring the abilities of .22's and their infinite brands of ammo. Dr. White is from Pelham, AL and build several kinds of silencers, mostly for .22's. Also several of White's articles over the years have appeared in Precision Rifle magazine too.
White is the author of Ruger 10/22 guide, "The Ultinmate Ruger 10/22, Manual and User's Guide",
and shows data indicating that a .22 Long Rifle's best barrel length is 14 to 16 inches - depending on the load. White also claims 11 inches is the [near] perfect length for the .22 Short.Of course everything I'm saying here is about non-suppressed .22's.
Skipping over to the Bullberry.com website, Fred lists data from two tests he conducted with his custom Contender or Encore barrels in the .204 Ruger and .17Hmr.
Starting with 24in barrels and chronographing them with representative loads, the Bullberry folks cut off 1-inch increments of each barrel all the way down to @10 inches, taking average velocities. It is possible to shoot both of those rounds in barrels too short, with unsatisfactory results!
The Bullberry site says that 23 inches is the optimum barrel length for the .204 Ruger, and 21 inches for the .17HMR. Keep in mind that the .17HMR is built on a bottle-necked .22WMR casing.
I've never even shot or used the .22 Magnum round, but my guess-timate for an optimum .22WMR barrel length is 18 - 18 1/2 - 19 inches. [b]However a nice round number of 20 inches would probably work quite nicely. Or even 18 inches!
Without any noticeable change in velocity. In the .22WMR I'd be happy with anything between 18-20 inches, but preferably in a heavy bbl.