Diesel cars, no longer popular in Europe, are definitely a pariah in the US. Americans never warmed to them, and VW's scheme to dupe millions of customers and pollute the planet didn't help. But diesels provide better fuel economy than gasoline engines, even if they do emit more pollution. The ideal internal combustion engine, then, would combine the efficiency of a diesel with the (relatively) lower emissions of a gasoline engine.

Automotive engineers have spent decades trying to build just such an engine. Mazda just announced it's finally done it.

The Japanese automaker says the Skyactiv-X will be the world’s first commercially available compression ignition gasoline engine. I'll explain the tech in a moment, but the big takeaway is Mazda claims the engine is 20 to 30 percent more efficient than its current gas engines, and at least as efficient, if not more so, than its diesel engines.

This Skyactiv-X is part of Mazda's goofily titled "Sustainable Zoom-Zoom 2030" plan that includes a shift toward electric cars beginning in 2019. But Mazda knows EVs won't dominate the market anytime soon, and this engineering breakthrough suggests the auto industry isn't quite done improving internal combustion.

A New Kind of Boom

First, a primer for those of you who aren't petrolheads. Internal combustion engines, whether they burn gasoline or diesel fuel, generate power by compressing air in the cylinder, adding fuel, and detonating the mixture. That creates a small explosion, which forces a piston down, turning the crankshaft, and, through the drivetrain, the wheels. Gasoline engines use a spark plug to create the explosion. Diesel engines compress that air to a much greater degree, making the air inside the cylinder hot enough to detonate the fuel without a spark. That higher compression ratio means higher efficiency from the engine, or more miles from the fuel. Advantage: diesel.

In gas engines, the fuel is injected earlier, and the air is kept cooler with a lower compression ratio. That means everything is mixed better, resulting in a cleaner burn that produces fewer particulates (soot, basically) and less nitrogen oxide (which is linked to asthma and other respiratory problems). Advantage: gasoline.

Efficiency-minded automakers constantly strive to elevate the compression ratio in gas engines, but are limited by something called auto-ignition (aka knocking), which is when the heat causes the fuel to detonate at the wrong time. But engineers have also been working on embracing auto-ignition, which would allow them to run an engine at even higher compression, and get that increase in efficiency.

Such an engine is great in theory and usually works in a laboratory. General Motors, Honda, and Hyundai have even demonstrated variations on the theme in prototypes over the last decade. And Formula 1 cars use the technology.

But compression ignition is difficult to control outside of a lab, or the cost-no-object arena of F1 racing. Those explosions happen whenever the fuel and air mix reach a given temperature, so engineers sacrifice the millisecond-precise control of spark plugs. The engines are rough when cold, unpredictable when pushed hard, and too often noisy and rattly. Not exactly market-ready.

Mazda hasn't given full details on how it cracked this conundrum, but computers can help. A sophisticated system can control the temperature and pressure in each cylinder by varying turbo boost or valve timing. It can mix in exhaust gas to change the mixture of fuel and air, and calculate just the right amount of gas to throw in.

Plus, Mazda didn't completely abandon current technology. The Skyactiv-X uses something Mazda calls "spark controlled compression ignition," which means the engine has spark plugs and uses them when necessary, like when the engine is cold. It promises a seamless hand-off between sparking and spark-free driving modes. Just how well it works remains to be seen, but you'll be able to judge for yourself, when the first cars with the new engine go on sale in 2019.