The critical factor is scale. Thousands of servers replaced with hundreds by more efficient code can be worthwhile.
If you require an ROI of 5 years, no interest included, you just created $600k in value over a few weeks.
Scale is key here, but fast software is always a much better user experience than slow stuff as well. With the compiler example, if it takes 1s as opposed to 1h, then users can iterate much more quickly and get a lot of flexibility.
Somehow programmers care about the big O notation, but not when it's about other people's time.