I recall a John Baldwin article on caloric planning for multiday ski traverses, in the VOC Journal in the early 1980s, that argued that a diet of 100% margarine or butter is the theoretical minimum weight per calorie.
Point is, fats have 9 cal/g, alcohol has 7 cal/g, and protein and carbs have 4 cal/g. So the more you have fats in your hiking food, the more calories per gram.
Problem is, many fats go rancid. Not an issue for an overnighter but can be a deal breaker on a multiweek trip. Thus, margarine, which is stabilized. Butter, sadly, melts if not refrigerated.
Of course modern consciousness of health dangers of trans fats makes the whole issue more complex.
Olive oil (or other seed oils) is your best bet if you are trying to pack calories with minimum weight. It doesn't go rancid like animal fat, it also contains more calories(9 x gram) than butter (7 x gram), it's non saturated, if it's good quality EVO it also has vitamins. It's been a staple in my backpacking diet since day 1. Well it's been a staple in my everyday diet since day one since I'm italian...