Actually, it seems to be more of the animosity of the weapon rather the effectiveness.
For example, the dagger is a small, sharp weapon that is used for quick movements. This description leaves the idea that the dagger is a quick, cunning, and visually nonthreatening form a distance.
That description then allows the brain to make the nearest connection to something we already know of and if I'm not mistaken the dagger seems to resemble the snake; and, as we all know the snake is also related to a deceptively silent and sneaky threat.
This is why when you see someone with a dagger from a distance, they seem like someone you can either outrun or disarm; but, close up, it seems to be something that can potentially kill you or lacerate the crap out of you jugular (especially if that dagger is right against your throat).
So if you apply that to a Sword, I could say that it resembled a threat because of it's long and broad geography that is sharp and moves with sweeping and lunging actions.
Along with a shield, that is used to knockdown opponents or defend the users self, it is viewed as The Lion.
The Lion being a proud and noble creature that uses its large paws and legs as the sword, sweeping, lunging, and knocking down its opponents, with a paralytic roar used to defend itself against any strike of its opposition.
Then when we think of lion we think of a beast that will kill without warning and without prejudice, having a full arsenal of debilitating and massacring its opponent. That is the sword.
Then finally the gun, a contraption that fires a blinding light and makes its enemies fall. It seen as a certain magic that will not work 100% of the time, because we cannot the bullet hitting the person and accuracy is an issue.
This leaves the gun to a the meager status of magic with low guarantee of working (depending on how good a shot the person is).
So in the respect of efficiency, yes the Gun far defeats the Sword.
In the respect of psychological sanctification, the Sword is a much more visceral and visually pleasing weapon; prompting the entire theory of why society, like the roman's, love their bloodshed.
Sword = Power, Sword = Bloodshed, Bloodshed = Excitement.
Gun = Visual Magic.