As you can see below, at the centre there's not much between the two lenses - it's the corners where the big differences appear, with the 17-40 being significantly better than the 18-55 wide open - although both have visible CA at the corners remember it's correctable if you're shooting RAW.
Both lenses perform best when stopped down to f8, the 17-40 being sharper, but not necessarily by as much as you might expect. By f22 there's not a lot in it, diffraction has claimed both.
Incidentally for some reason at this test target size (A3) the 18-55 @18mm is actually covering a wider area than the 17-40 @17mm - this may change at infinity though. The camera distance wasn't changed during this test.
The 18-55 also has far more barrel distortion, but again that's fixable but at a slight loss in image quality.
Since the camera used has an APS-C sized sensor, it"s hard to gauge full frame performance - however, it"s worth remembering that the 18-55 is EF-S only, and so won't fit a full frame camera anyway...
100% crops:
17-40 @ 17mm f4 corner: |
17-40 @ 17mm f4 centre: |
18-55 @ 18mm f4 corner: |
18-55 @ 18mm f4 centre: |
17-40 @ 17mm f8 corner: |
17-40 @ 17mm f8 centre: |
18-55 @ 18mm f8 corner: |
18-55 @ 18mm f8 centre: |
17-40 @ 17mm f22 corner: |
17-40 @ 17mm f22 centre: |
18-55 @ 18mm f22 corner: |
18-55 @ 18mm f22 centre: |