All pictures were taken with RAW + JPEG, and all the pictures you see here are jpeg straight out of the camera, without any further processing, just to make sure they are processed identically in-camera. The Sony jpeg engine is absolutely horrible.
Size comparision: Left - Carl Zeiss Planar 50mm f1.4; middle - Zeiss 45mm f2.8; right - Pentax 40mm f2.8.
So, which one wins?
Both are winners. The Pentax is a hair sharper than the Zeiss wide open in the center, but the Zeiss seems to have a nicer bokeh, and a tiny bit better at the corners.
Pentax 40mm f2.8 @ f2.8
Carl Zeiss 45mm f2.8 @ f2.8
If you care about edge sharpness, you won't be disappointed with either lens. It would be like splitting hair to tell the difference, although I would say the Zeiss is ever so slightly better. It's amazingly good on the far corners wide open, one of the traits of a Tessar design.
Far corner 100% crop -- Pentax wide open @ f2.8
Far corner 100% crop -- Carl Zeiss wide open @ f2.8
I think both lenses cost about the same, but I am still a bit surprised how good the little Pentax pancake is. Both are worth owning.
bokeh -- Carl Zeiss 45mm f2.8 @ f2.8
bokeh -- Pentax 40mm f2.8 @ f2.8
Note that I didn't post any pictures with apertures smaller than f2.8. Stopping down the lens improved the sharpness a little, but not as much as you would expect. Both are very sharp from wide open. The only draw back is the rather smaller maximum aperture of f2.8. But hey, you want small size, you have to pay for that with less light coming through the lens.