In most petrol engines, the fuel and air are usually mixed after compression (although some modern petrol engines now use cylinder-direct petrol injection). The pre-mixing was formerly done in a carburetor, but now it is done by electronically controlled fuel injection, except in small engines where the cost/complication of electronics does not justify the added engine efficiency. The process differs from a diesel engine in the method of mixing the fuel and air, and in using spark plugs to initiate the combustion process. In a diesel engine, only air is compressed (and therefore heated), and the fuel is injected into very hot air at the end of the compression stroke, and self-ignites.
With both air and fuel in a closed cylinder, compressing the mixture too much poses the danger of auto-ignition — or behaving like a diesel engine. Because of the difference in burn rates between the two different fuels, petrol engines are mechanically designed with different timing than diesels, so to auto-ignite a petrol engine causes the expansion of gas inside the cylinder to reach its greatest point before the cylinder has reached the “top dead center” (T.D.C) position.
Spark plugs are typically set statically or at idle at a minimum of 10 degrees or so of crankshaft rotation before the piston reaches T.D.C, but at much higher values at higher engine speeds to allow time for the fuel-air charge to substantially complete combustion before too much expansion has occurred – gas expansion occurring with the piston moving down in the power stroke. Higher octane petrol burns slower, therefore it has a lower propensity to auto-ignite and its rate of expansion is lower. Thus, engines designed to run high-octane fuel exclusively can achieve higher compression ratios.
Petrol engines run at higher rotation speeds than diesels, partially due to their lighter pistons, connecting rods and crankshaft (a design efficiency made possible by lower compression ratios) and due to petrol burning more quickly than diesel.Because pistons in petrol engines tend to have much shorter strokes than pistons in diesel engines, typically it takes less time for a piston in a petrol engine to complete its stroke than a piston in a diesel engine. However the lower compression ratios of petrol engines give petrol engines lower efficiency than diesel engines.