RAW file size (lossless-compressed variants) for the same scene across apertures is an excellent measure of the total detail recorded, which includes the effects of depth of field, diffraction, and lens performance.
With a planar scene (which eliminates depth of field as a variable), file sizes can tell you exactly where peak lens performance is reached in terms of recorded detail.
For the example at right, the scene is not strictly planar; there is some foreground and some background and the camera is tilted up slightly. Still, it’s mostly planar.
Observe that the peak file size is reached at ƒ/4, indicating that the maximum amount of detail is being recorded.
Aperture ƒ/5.6 maintains this file size, but diffraction begins to soften detail at ƒ/8, which thus drops the file size.