In my opinion both great performers, and i have owned both, Really the 50 suffers from the least vignetting to my eyes, but only marginally.
The 40 is great and has minimal distortion for the focal length, both really crisp, but the 50 i think is a little crisper wide open than the 40.

Both are great, get one and be happy.