Which is better for gas and the car: idling or shut the engine off?

When you are waiting for somebody in the driveway, is idling better than shutting it off as it puts no burden on the battery? Is shutting it off saves more gas than idling? Does that depend on how long you wait and the type of car? Is it bad to turn the ignition on and off too much? I’m trying to save gas while minimizing the damage to the battery or any parts of the car and the environment as much as possible.

If it’s going to take two minutes or longer, shut the engine off.

Tester

Cars burn anywhere from .16 to .8 gallons per hour idling. The lower figure is for small four cylinder engines and the higher figure is for big V-8 engines.
If it’s longer than a short moment, shut it off.

No, restarting the engine won’t burn more gas than leaving it running. Since the engine is already hot when you restart it, it just continues where it left off. It’s not like the engine is ice cold a minute after shutdown and has to warm up all over again, which I think is the premise that the old “it takes more fuel to restart the engine than to leave it running” idea is based on.