If an engine is being used for a task which can make use of all the mechanical energy it produces (such as charging a battery or pumping water as quickly as possible from a supply that's sufficient to avoid cavitation), optimal efficiency will be obtained by having the engine run at wide open throttle but having the load torque match the engine torque when the engine is rotating fast enough to allow "smooth" combustion without detonation, but slowly enough that all the fuel can burn during the power stroke. If the engine is allowed to run faster than that, fuel consumption will increase roughly proportional to speed, but power output will not, since an increasing portion of the fuel won't burn during the power stroke. If the engine isn't allowed to run fast enough, then cylinder pressures will get excessively high. Because fuel burn rate increases with cylinder pressures, this will quickly cause pressures to get even higher, resulting in a process called detonation. The excessive forces generated during detonation often end up getting converted not into useful energy, but rather to accelerated wear and tear on the bearings.
While wide-open throttle operation may be optimal for applications that can adjust the load to control engine speed (e.g. an alternator whose purpose is to charge a battery may have its field windings continuously adjusted so that the amount of energy sent to the battery per revolution increases with speed), it doesn't work so well in a car, since the amount of power that is needed to make a car move at a desired speed will vary markedly with driving conditions. Most automatic-transmission cars are designed so that when the driver floors the accelerator pedal, the motor will be operated at a speed which is considerably faster than its maximum-efficiency point. Operating a motor at 6,000rpm wide-open throttle will likely consume fuel more than twice as fast as would operation at 2,500rpm, but will not generate twice as much mechanical power.
In a manual-transmission car, once the vehicle was moving, one could accelerate efficiently by flooring the accelerator between shifts, but upshifting as early as possible without lugging the engine. If one shifts an economy car into 5th gear at 40mph, reaching 65mph will take a lot longer than if one had stayed in 3rd gear to 50mph and 4th until 65mph, but the total fuel required to accelerate to 65mph and drive to a point some distance from the starting line would be reduced [the early-shifted vehicle might take so much longer to reach 65mph that it uses more fuel during that time, but the distance traveled during that time would reduce the amount of fuel required to drive the rest of the way to the destination].