If you were a fighter pilot in WWII, would you rather have the high rate of fire of the 50 cal, or the hitting power of the 20mm? I personally feel the 50 cal was plenty hard hitting enough to take out ANY aircraft, and its high rate of fire made it even more effective...the slow rate of fire for the 20mm meant you had to be a much better marksman...
The question has to go beyond the rate of fire and size of the shell. You have other important considerations, such as:
Reliability - Shoot, it won't shoot!
Production/parts availability
Ammunition capacity; how many seconds of shooting do you need?
What is you intended target, bomber, fighter, tank?
20mm ammo may be more effective than .50 cal, but how many rounds can you carry?
Take a P-51; ~300 rounds/gun for .50 cals, 60-120 rounds/gun for the 20mm. It's size and weight that limit the 20mm ammo.
Here's an interesting reference site:
The WWII Fighter Gun Debate: Gun Tables