Get Void Staff first. You'll do more damage to champions, have 1k more gold (for pen boots which increases the damage even more), and you'll do more damage to champions earlier in the game with all that penetration. The 1k less gold of Void Staff is often overlooked but it really makes the item pull ahead of Deathcap in efficiency early game and you'll basically never have to sell it anyway because you'll still want the item in your final build 99% of the time. You have to understand that Rabadon's Deathcap is a SCALING ITEM. This means you generally want this item after you have amassed a really respectable chunk of ap due to the linear scaling of raw ability power (on Veigar... 3rd-4th item depending on your stacking but everyone else should typically get it as a 5th or 6th item (this is an unpopular truth so I expect downvotes but it's still the truth in the majority of mage cases)). Stats such as magic pen, cdr, mana, and item effects like Rylai's slow, Liandry's burn, or Morellonomicon's grievous wounds, Zhonya's ability to keep you alive to perform more spells after stasis, etc. will do you more good for you and your team than raw ap alone (especially in the early/mid game).
Again, this does not count for EVERY mage as they are all different and some may be better off with a more assassin-y style where you want to rely on one spell rotation to burst a single squishy target but for overall utility, dps, and effectiveness mages are better off buying other items before Deathcap.