How fast does cabin air pressure leak after a total engine failure?
The valves will not be able to maintain cabin pressure until the plane descends to 10,000 feet at best glide speed. The oxygen masks will deploy before then.

At least that was the case for Air Transat Flight 236, an A332 that ran out of fuel over the Atlantic and glided to a deadstick landing. The occurrence report on page 96 (see the table) estimates that oxygen masks deployed at 06:37:50, when the cabin altitude reached 13,500 ft. This was about 11.5 minutes after fuel exhaustion, and only 7-8 minutes before landing at 06:45. So they would have landed within the 10 minutes of supplemental oxygen. Even a much longer glide would have allowed them to descend below 10,000 ft before the supplemental oxygen stopped. TSC 236 is AFAIK the longest glide in a transport category aircraft to date, so if they did not "encounter a situation where they have to choose between oxygen and best glide" (to use your phrasing), then probably no one else did either.

Note: The report used the 'worst case' leak rate of 700 ft/min for their calculation. The footnotes explain that the leak rate would decrease as the aircraft descended (because the pressure differential between the cabin and the outside would decrease as the aircraft descended). If anyone is interested, there is more info on pages 28-29 of the report about the cabin pressurization.