I disagree with all this talk of "wasting a lot of energy". When I am riding with constant pedal force, the suspension compresses very little, if any. The severe loss of efficiency occurs when power peaks to the pedals occur - sprinting or hill climbing. IMO the effect is very roughly up to 30% when sprinting. With climbing it depends on the terrain and your willingness to adjust gears. Keep a stable, high cadence* (as if riding on a road) and there will be no unnecessary compression at all.
Now, locking the fork is useful for road biking, right? If you ride at a constant, high, boring cadence on the flat, boring road - no unnecessary compression. In my country, even in the capital, most roads have mean distance between road holes in the order of tens of meters.
So I do not lock my fork. I suffer in sprints (sprints are bad for your knees), but ride more comfortable through road defects.
Note: I have not used high quality forks with suspension lockout(nothing over a hundred bucks) - so it could be that my answer is irrelevant.
* high cadence == low pedal force (for the same power output)