The one thing you have to remember in all this, is that even though Diffraction may cost you sharpness in huh f-stop image, nothing causes more loss of sharpness, than the effect that creates narrow Depth of Field in a wide open lens. Sites like photo zone concentrate on absolute sharpness in a given plane. But many times even though the lens may be sharpest at ƒ5.6 the overall sharpness of a 3D image may be improved by stopping down, sometimes to as much a ƒ22, if you are trying to keep your whole subject in focus. Good lenses can be sharp wide open, but they can't provide the amount of print area in acceptable focus a stopped down lens can.
SO the issue is not just what is the sharpest focus, but also what is acceptable focus.
DoF so narrow you almost can't find it, but great bokeh (out of focus areas). The subject is mostly out to focus because of the narrow depth of field, and that can be really irritating.
ƒ2.8
ƒ5.6 the sharpest resolution for this lens, but still not a lot of depth of field.
ƒ11… much wider DoF and more of the subject in focus. The bokeh is starting to get messy... in a commercial image where there my be text placed in the OoF areas, that may become a problem.
ƒ22 even the little bits of dirt in the foreground are in focus… very wide Dof, out of focus areas have become pretty messy. Noticeable loss of sharpness compared to even ƒ11 comparing the sharpest areas, but is much sharper than ƒ11 in out of focus areas, with some portions of the image that are soft at ƒ11 being in acceptable focus @ ƒ22, even if they aren't razor sharp. Bokeh is becoming distracting.
So how you define sharpness in the 3D world is very differential from how you define sharpness on a test chart. IN the real world, ƒ22 is a real option. Not so much on a test chart. But it's still about sharpness.
I find what I end up thinking of as the sharpness, is often the best compromise between absolute sharpness and a DoF that matches the subject matter. And that really isn't predictable using any kind of formula I know.
IN terms of the original question, you need to see a lens diagram….
" target="_blank">
The wider the area you collect light from, the bigger your circle of confusion will be in your out of focus areas. A pinhole camera has infinite D0F but it's image is greatly limited by diffraction, because the pin hole is very small, so light isn't being collected from a wide surface but diffraction is a problem. Using a lens theoretcial sharpness exists only at the "image plane". But in the areas in front of and in back of the image plane the image may be in acceptable focus, because the circles of confusion are so small, they are judged by the eye to be "sharp".Theoretically any lens below the point at which diffraction starts to degrade the image should be equally sharp if the images is in sharp focus from it's widest to it's narrowest aperture setting. (APS-c is Aperture limited after 5.6) However practically it's very difficult (and expensive) to do that. Most lenses have a sweet spot, somewhere around ƒ5.6 that is the best combination of sharpness based on a smaller aperture, and before diffraction becomes an issue. Although I find diffraction doesn't really become and issue until after ƒ11 if the bokeh is OK.