I know quick match is a single game and ranked can be "Best of 3" or Best of 5". But in comparison which one is better for XP gaining?
In a general sense, Quick Matches will gain you XP faster, but this may not hold true across the board. The explanation can be found on this post from a thread on the Battle.net forum:
At the moment, the XP awarded at the end of the match follow theses rules.
- Each seconds in a match : 4.01 XP
- Match finish : 250 XP
- Match won : 500 XP
- Consecutive bonus : 200 XP
- Gold Medal : 150 XP
- Silver Medal : 100 XP
- Bronze Medal : 50 XP
For this argument, let's say in the time it takes to do 1 competitive match, you did 2 quick play match. Let's assume you played for a total of 15 minutes in both type of play and got gold in all matches and won the matches.
Competitive XP = 3609XP (time) + 250XP (finish) + 500 XP (victory) + 150XP (gold medal) = 4509XP or 18036XP/h
Quick play (for both games combined) = 3609XP (time) + 500 (finish) + 1000 (victory) + 300 (gold medal) + 200XP (Consecutive match) = 5609XP or 22436XP/h.
As you see, you gain more XP when the matches are fast and less when the matches last longer. Also, you lose the consecutive bonus in competitive play and the medal after each rounds. This make competitive play far less rewarding for the sole purpose of XP grinding.
And this is not even considering that the time in queue for quick play is generally far less than the time in queue for competitive...
Despato's Analysis is accurate for the scenario where you win all of your games, but here I will present a few other scenarios. I will be sharing the assumption that you can play one game of competitive in 15 minutes, and you could do two games of quick play in the same time. To balance accuracy and simplicity, I'll be assuming you can get into a new match in 1 minute (I'm not sure if this is close to accurate, feel free to correct me)
Scenario 1: You win all of your games and earn a gold medal every game (Despato's scenario except for the queue time)
Scenario 2: You win half of your games (randomly distributed) and earn a silver medal every game (suggested by ChaseSandmann)
Scenario 3: You win none of your games and earn a bronze medal every game
Scenario 1 Analysis:
Amount Per Competitive Game: Time: 3368 + Finish: 250 + Victory: 500 + Medals: 150 = Total: 4268 XP
Per Hour: 4468 * 4 = 17072 XP per hour
Amount Per Quick Play Game: Time: 1564 + Finish: 250 + Victory: 500 + Medals: 150 + Consecutive bonus: 200 = Total: 2664 XP
Per Hour: 2664 * 8 = 21312 XP per hour
Conclusion: You earn ~25% more experience in Quick Play
Scenario 2 Analysis:
Amount Per Competitive Game: Time: 3368 + Finish: 250 + Victory: 250 + Medals: 100 = Total: 3968 XP
Per Hour: 4168 * 4 = 15872 XP per hour
Amount Per Quick Play Game: Time: 1564 + Finish: 250 + Victory: 250 + Medals: 100 + Consecutive bonus: 200 = Total: 2364 XP
Per Hour: 2364 * 8 = 18912 XP per hour
Conclusion: You earn ~19% more experience in Quick Play
Scenario 3 Analysis:
Amount Per Competitive Game: Time: 3368 + Finish: 250 + Victory: 0 + Medals: 50 = Total: 3668 XP
Per Hour: 3868 * 4 = 14672 XP per hour
Amount Per Quick Play Game: Time: 1564 + Finish: 250 + Victory: 0 + Medals: 50 + Consecutive bonus: 200 = Total: 2064 XP
Per Hour: 2064 * 8 = 16512 XP per hour
Conclusion: You earn ~12.5% more experience in Quick Play
So in final conclusion, you definitely get more XP over time for Quick Play, though the advantage is lessened significantly as your win rate goes down
*Disclaimer: I am not an Overwatch player, so I am doing this analysis based only on the data I was able to find online and a few basic assumptions.
*Edit: I was informed that you don't receive a consecutive bonus on Competitive Games, so I adjusted my calculations to match. This definitely increases the advantage of Quick Play over Competitive for XP gain