Hi Dave. Been mega-busy and barely on-line lately. Shouldn't be on-line now. No matter.
Sharpness is a balancing act between lens issues wide open (no lens is perfect wide-open, though the very best ones come close) and diffraction stopped down. The more you stop down, the worse diffraction becomes. On the other hand, the less you stop down, the worse the glass in your lens performs. (Again, excepting unusually high-quality lenses.)
The best compromise is normally in the middle of the aperture range. It varies from lens to lens, but a good rule of thumb is to try to stay near the middle (say f/8, give or take). Let's do an (imaginary) sharpness table for an (imaginary) typical lens - something a bit like your 18-55.
f/3.5: blurry
f/4: a little better
f/5.6: better again
f/8: excellent
f/11: still excellent
f/16: a bit fuzzy
f/22: noticably fuzzy
>f/22: don't go there.
With a really really high quality lens, it's different. Something like, say, a Canon 300/2.8L is as sharp wide open as it is at f/8, or possibly even sharper. Mind you, that's an $8000 lens, and it's a prime, and it's a focal length that is relatively easy to design for - zooms are harder, wide-angles are harder still, an ultra-wide zoom is possibly the hardest ask in optics. (Which makes the Canon 10-22, by the way, a bit of a miracle product - it's astonishingly good.)
People often say that diffraction starts to kick in at about f/11 and gets worse from there. Actually, that's not so. It kicks in at f/2.8 (on an f/2.8 lens, that is) and increases from there. On most lenses, in the wider-than f/6.7ish range you gain more optical improvement by stopping down to use the "best part of the lens" than you lose because of increased diffraction, then you level peg from f/6ish to about f/10; from there on your optical improvement with smaller apertures is essentially nil while diffraction gets lots worse with each f stop.
Diffraction is proportional to the dimensions of the hole that lets the light in. It is caused by the edge of the diaphragm - i.e., the diffracted light ("bad" light = blur) is light that passes close to the edge, while non-diffracted light ("good" light = sharp) does not pass close to the edge. It follows that diffracted ("bad") light is proportional to the circumference of the diaphragm, while non-diffracted ("good") light is proportional to the area of the diaphragm. (Well, the area of the hole in the diaphragm, actually, but you know what I mean.) In turn, this means that when you make the hole bigger you increase both the diffracted and the non-diffracted light, but the diffracted light change is a linear function while the non-diffracted light change is a square function. In short, the bigger the hole, the less significant diffraction becomes.
Note that "raw" optical quality (by which I mean everything else except diffraction), and the changes in "raw" optical quality with increased or decreased aperture vary from lens to lens - in broad, the most expensive lenses in the easierst-to-make focal lengths are sharper wide open or stopped down only a little. BUT diffraction has nothing to do with the quality of the lens. At the same f stop, your $80 18-55 zoomed to 50mm and a $2000 50/1.2L have exactly the same diffraction. There is nothing Canon or any other lens designer can do about it. It's just physics.
For any given size of photosite on the sensor and any given sized hole to let the light through, diffraction is a constant. Make the photosites bigger to reduce diffraction and you lose resolution - in a tiny-sensor 12MP P&S it's worth doing, in a big-sensor 20D it's not worth doing as you gain less diffraction reduction than you lose in resolution. (Which is to say that a 12MP P&S is a bad design where an 8MP APS-C 20D or a 10MP D40X are good designs, both are in the ball-park of the best possible compromise. But we already knew both those things.)
Anyway, the short answer is stick to sensible aperture values.
On the 18-55 at the wide end, these are roughly f/5.6 to f/16; at the long end, f/8 to f/16.
On the 10-22, feel free to shoot wide-open if you need to (it's not as good but it's still plenty good), but stop down a little bit (half a stop or one full stop) whenever you can. Depth of field, even wide open, is amazing on such a short lens, so you shouldn't ever really need to go beyond f/8 or f/11, or at most f/16. Odds on, though, anything you shoot at f/16 or f/22 on the 10-22 (especially at the wide end) will look better if you shoot the same scene at f/8 or f/11.