My first question: if you were to set the entire gallon of gasoline on fire, how efficient is the reaction? I'm sure there's probably some gasoline that won't burned, but it's pretty flammable. Would the reaction be along the lines of 90% efficient?
Eventually, it would all react due to evaporation and oxidation.
Now with a gasoline engine, when fuel is injected into the cylinder and the spark plug gets the juice to make it go boom, is that reaction itself not also of similar efficiency?
No, you put energy into the reaction which makes it more rapid, so you will get more energy out faster. Secondly, it is under pressure, so that changes the thermodynamics and kinetics as well. The efficiency is calculated based on a variation of the carnot cycle equation.
I realize that internal combustion engines themselves are very inefficient, along the 15-20% lines because there are so many other factors in play to actually propel a vehicle forward. But to keep it simple, is not the combustion of gasoline inside the cylinder of similar high efficiency?
The factors that play a role are heat loss and friction (uncontrollable) and kinetics (% oxygen/air). If you injected pure oxygen, you would get higher performance. This is why some people use nitrox blends. However, it is not that economical to do so on a full time basis. If they found an economic way to make oval cylinders, it would increase the efficiency by at least 10%. Car engines are far more efficient than you think.