Swords in War Tests have shown a guy with a knife has to be less than 10 yards away to stand a chance against a firearm, short range even for handguns. A sword gives you only an extra yard. Meanwhile, practiced shooters can put >5 rounds a second into your chest at >5 yards. As far as reliability, the M4 is 98% reliable after 6000 rounds and 6 months of having dust dumped in it, and its considered an unreliable weapon by many. There's a reason why many newer assault rifles have no bayonet lug. Even in ye olde days, swords were weapons of last resort. The samurai, Mongols, and Romans didn't draw their swords until they ran out of arrows/javelins and broke their spears. The English longbow and Swiss pike creamed knights (who preferred lances) repeatedly.