The principle of heat pump operation can be explained as 5 litres at 20 degrees Celsius (sorry for metric) contains the same amount of energy as 1 litre at 100 degrees. The heat pump is the device that can capture the heat from the 5 litres and convert it to get the temperature in the 1 litre. This is termed the coefficient of performance and typically 4:1 lots of other factors.
What has happened in this market is manufacturers realised the industry was comparing on coefficient of performance at 4:1 so started to fiddle about with the other factors to get coefficient of performance at 6:1, and other silly numbers. Unfortunately it is very mathematical to convert back to equal every one out. Can be done takes time and a forum is not the place for that. Consequently, for the consumer, life gets very confusing as many dealers are unaware of above and will promote what they believe and honestly think is best being the unit with the highest claimed coefficient of performance.
The cheaper to run comes from the amount of energy input.
A water body is simple to heat we have a saying it goes kilowatts in kilowatts out. By this we mean the amount of energy required to heat a pool is no more or less regardless of when it is required or how it is delivered.
To properly asess the difference first convert the heat load to a common factor in my case kW, you may work on BTU or mj or something.
Target temperature - starting temperature by volume by a factor applicable for your area will give energy required.
Energy required divided by units of energy cost for gas gives a notional run cost for gas
Energy required divided by 4 of energy cost for electricity gives a notional run cost for power
From this very rough estimate a fairer comparison can be made.
Having said all that...Heat pumps are better at holding a temperature for a long period of time. Say all year round. Gas heaters are better at getting a lot of energy into a pool fast. Therefore the gas heater is better if switching off and on with say a days notice a heat pump can take a week to heat a pool up from cold.
Another factor is temperature.
Gas heating if you dial in 28 degrees you get 28 degrees
Heat pump if you dial in 28 degrees you get anywhere from 24 to 30 depending on other ambient conditions.
Final hint: If you have a high humidity climate. Heat pumps work better. In a dry arid climate heat pumps still work but just not as well.