It doesn't really work to ask or answer this question independent of rear cluster gear count, range, and chainring tooth difference. In particular, road compact vs standard front gap leads to totally different strategies with shifting.
The more gears in back for a given cluster range, the less downside there is to just staying in the same chainring chosen based on the terrain you're in. The technically most optimal gear may still be on another ring, but there are efficiency and enjoyment downsides to doing all that back and forth shifting to stay on top of it. This effect has increased marginally with each speed generation.
The greater the chainring gap, the more rear shifting you need to do if you insist on sequencing your gearing exactly. That's a big reason why compact really took off in the days of 10 speed and not 5 speed - with 5 speed rear ends you're priced in to doing that sequencing, but with 10 it matters a lot less.
Also the greater the ring gap, the more gear values you're going to have back to back on the same ring at the extremes of the bike's gear range. For example, on 11-speed 34-50 11-25, the top 6 or so gears are all on the large ring and the bottom 4 or so are all on the small, so there's going to be a lot of the time where the most optimal sequencing involves no front shifting at all. Compare that to five-speed 42-52 13-25, where the only the top 1 or 2 and bottom 1 or 2 gears are on their respective chainrings. Again, you're then priced in to hunting around.
If you want to master this topic, studying different setups in a gearing calculator like https://www.sheldonbrown.com/gear-calc.html is a good idea.