In general a barometric altimeter is the best thing available. But there are situations where they don't work so well. In cold weather,
barometers will under-report elevation. Also, a barometer measures air pressure, and tells you elevation from that, but air pressure changes, so a barometric altimeter can only work if it's calibrated to the
current air conditions. If those change while you ride, it's going to get confused.
In some places the elevation correction database is pretty good and in some places it's not. Another problem with corrections is side-to-side GPS accuracy; if you're in a canyon and your GPS puts you 30 feet to the left, that could be 100 feet higher or lower than you really are. GPS accuracy tends to suffer in canyons where this is more of an issue.
The point is that there are a lot of variables, so there isn't a best way of knowing elevation, there's only a best way for the conditions. That's probably why sometimes Garmins work well and sometimes they don't.