Economist John Williams once stated that gold is the best hedge against inflation. From a historical perspective, can gold really resist inflation?

Comparing the year-on-year performance of the US annual CPI with the annual rise and fall of gold, it is not uncommon to see high inflation accompanied by a strengthening of gold. For example, in 1979 and 1980, the inflation rate in the United States exceeded 10%, and during the same period, COMEX gold futures prices also surged, rising by more than 10% and 130% respectively.

But not in all years, high inflation is accompanied by an increase in gold prices. For example, in 2022, the inflation rate in the United States reached 8%, but the overall trend of gold was volatile, with a slight decline throughout the year. So, can gold really have an anti inflation effect?