The higher compression ratio of the diesel engine leads to better efficiency.
Actually, a diesel is more efficient because it's closer to a constant pressure combustion cycle than a spark ignition engine.
The fuel is injected, not in one big lump, but as the piston is going down on the power stroke, so keeping the force on the top of the piston for longer, making it more efficient.
So, within the bounds of practicality, a spark ignition engine is a constant volume cycle and a diesel a constant pressure cycle.
-David C.