It's funny how culturally, we paint business practices of optimizing profit as picturesque but paint labor optimizing their profit as a sin.
It's really all a matter of perspective and somewhere, most the labor force was convinced to take the capital owners perspective.
Organised labour movements are supposed to be about what is fair.
A fair wage for fair safe work.
Unfortunately, the economic system we've adopted tends to work quite well at finding extremes and many of the corrective measures to flatten these out are failing more and more.
As little as possible within some allotted time, or spending as little time as possible?
The first one sounds miserable.
If other personal resources make more sense (your car/fuel, building materials you obtain, existing code bases you already created, etc.). You should be optimizing for yourself.
This gets a real ugly name applied to it as well, the label of "time thief". How dark is that?