The .40 is the perfect mix in effective AND ammo capacity. Speed of the bullet, bullet weight, capacity, cost, and availability all influence my decision, but EFFECTIVENESS is the most important.
Here's a picture of my shooting an old steel water heater at 50 feet with 9mm and .40 caliber. The dents are the 9mm. The holes are the .40. Using similar factory ammo.
I've been through many shooting schools. When I was at Gryphon Group, we were issued the .40 because the 9 would not reliably penetrate windshields because it was too light, and the .45 was too slow to penetrate windshields consistently. Issues with the 9 and .45 penetrating AND remaining on target. The .40 was the ideal speed and weight to consistently punch through AND remain on target. That's me in the drivers seat in the picture. Training operation was shooting at targets through windshields and through side and rear windows.
While not scientific, it does make me want to carry the .40 over the 9mm. It demonstrates the deeper penetration through hard targets - breaking bones like ribs and femurs, penetrating car doors, wood desks, windshields, or wood studs that you may need to shoot through in self defense. Since most of us spend a lot of time driving, being able to shoot in self defense through a windshield or car doors etc. is important to me.