The 40 has a higher sectional density and BC due to it being the same weight and smaller diameter. Meaning the .40 has more potential to penetrate deeper. BC wont really matter at pistol ranges, but SD does still count for something. .45 has .05'' bigger starting diameter, which means at least .05'' bigger holes in the target. As long as the .45 could inherently penetrate your target, the .40 doesn't have much of an advantage. If the .45 isn't exiting the target or is only sometimes exiting the target, the .40 may be a little better.
The .40 also has advantage with heavy for caliber bullets. A 200 grain .40 tends to move faster than a 230 grain .45 and the 200 grain bullet has a slight advantage on SD, again, over the .45
I want all of my bullets energy to be spent inside the bad guy.
I want that too with high velocity rifle rounds. But for pistol wounds i'd much rather have exit wounds in my target. 'Dumping' 500ft-lbs of energy from a pistol wont really do much, it wont create the same type of trauma, that you'd get from a .30-06 for example. The velocity just isn't there. The most ideal situation for a pistol wound would be a full pass through, with a nice large exit wound. Ideally the bullet would pass through, and a piece of cardboard would be able to stop the bullet after it passes through. This would essentially mean the bullet shed 99.5% of it's energy in the target, while still offering an exit wound to cause faster bleed out. I wouldn't want my bullet stopping in the target. That would mean that there's just that much less bleeding taking place. Exit wounds are always better IMO, and for just about any target, the best you could ask for, IMO, is 99.8% energy dumped into the target with a bullet that still exits the target, able to be stopped by paper or cardboard. There's no real way to make this happen 100% of the time, so it's my belief, that it's worth it to sacrifice a small percentage of that energy 'dump' for penetration, to ensure there are inherent exit wounds.
Just my $.02