Gas to electricity efficiency is low so you loose more then half the energy when producing electricity from gas. Using a 90 percent efficiency furnace to heat water directly with gas is the better solution.
Assuming your electricity comes from gas plants.