A few things worth adding to previous comments:
As you close the aperture, at some point the diffraction effects will start decreasing sharpness. This depends on the size of the sensor and on an APS-C happens typically from f16.
Here is more information including a calculator:http://www.cambridgeincolour.com/tutorials/diffraction-photography.htm
Aperture that yields the maximum sharpness often depends on the design of a particular lens. For example many cheap 70-300 zooms from the film era e.g 20 or 30 years old designs did not become really sharp until f11 especially at the long end of the focal range.
By comparison recently designed lenses, especially the more expensive ones are designed to be tack sharp at maximum aperture at least in the centre and then take only one stop to become sharp across the whole image. Sigma 35/F1.4 HSM and to an extent Canon EF 35/F2.0 IS USM are good examples.
This was achieved in recent designs due to better design methods, better coatings, use of aspherical lenses and new special types of glass. This design trend is driven by demand - people pixel peeping. In the film times the maximum aperture value was often more important, as film had low light sensitivity expressed by ISO value.
It is quite instructive to play with the clickable diagrams with sliders published in the reviews of slrgear.com. Click on the blur index (sharpness) diagram, wait for it to pop up and play with the aperture and for zooms also with the focal length sliders.http://slrgear.com/reviews/showcat.php/cat/10
This one is really interesting for EF 50 F1.4 USM:http://slrgear.com/reviews/showproduct.php/product/140/cat/10
Look at the results for this lens measured on full frame Canon 5D.
At f1.4 only small area in the centre is sharp. The corners are a mess. The lens becomes very good at F4 and perfect corner to corner at F5.6.
Finally it is worth noting that all lenses have significant manufacturing variations in sharpness. 20% is common. Here is a very nice blog on this subject by Roger Cicala.http://www.lensrentals.com/blog/2013/09/there-is-no-perfect-lens
But even 20% variation is not really noticeable in real life, unless by obsessive pixel peepers (:-)).
I hope this helps.