In an engine, the valves open and close to control how the air/fuel mixture enters and how the exhaust exits the combustion chamber. In most gasoline engines, the vales open for the same amount of time and open the same distance regardless of how hard the engine is working. How hard an engine is working is known as its speed. Engine speed doesn't track how fast a car's moving down the road. Instead, engine speed refers to how fast the engine's crankshaft is rotating. That rotation comes from the pistons in the engine's cylinders. The faster they go, the faster the engine speed -- and the harder the engine is working.
Imagine that you're working out really hard. You're going to need lots of fuel, in the form of calories -- and lots of air. You car's engine is the same way, only it uses gas for fuel instead of calories. When you're just ambling along, you don't need as many calories and air. Same with your engine. If the engine valves open for the same amount of time and just as wide regardless of how hard the engine is working, some fuel will get wasted. That's because the engine is getting the same amount of fuel and air whether it's coasting or towing a heavy load.
By varying the time and distance that the valves open, the engine gets just enough fuel and air for the task it's currently performing. In fact, variable valve timing and lift can make a gasoline engine about 5 percent more efficient [source: U.S. Department of Energy].