WWII was probably the last major warfare when we saw melee combat between China and Japan.
The weapon of choice for the Chinese side is the Dadao (literally "Big Saber"), while the Japanese is famous for their Banzai Charge with their long rifles with a bayonet attached. If we were to relate this to medieval combat, it will be something like "Swords versus Spear", since the length of the Japanese rifle + bayonet is almost 2x longer than the Dadao.
Even in Chinese martial arts practice, the Spear is considered as the King of the Battlefield, because:
It has a very long length. "One inch longer, one inch stronger", is a common phrase in Chinese martial arts.
It is easy to learn and use.
You can slide the Spear to gain extra reach without having to rely on footwork.
So generally speaking, the Sword will lose to the Spear.
In the above video by Lindybeige, they did an experiment of Spear versus a variety of weapons. The results were as expected, the Spear won most of the times.
So why was the Chinese Dadao (a sword) efficient against the Japanese Rifle Bayonet (a Spear)?
I made an explanation in the above video. Basically, the reason is because the Rifle + Bayonet, although its much longer than the sword, but it doesn't have the advantage of a Spear.
You can't keep your front-grip loose and slide your weapon down, and thus lose the advantage of gaining reach without using footwork.
In this TV program, they had an experiment fight (at 8 mins), where they pit 10 Dadao soldiers against 10 Rifle + Bayonet soldiers. The results was that the Dadao soldiers were vanquished.
This experiement was inaccurately conducted, because the Rifle soldiers were using it like Spears. Watch the video carefully and you will see that Rifle soldiers were sliding their weapon by keeping their front grip loose, as if they were using a Spear
The black and white footage of Sword versus Bayonet was taken in 1934, and it's a much more accurate representation of how a Dadao would fare against a Bayonet.
Notice that the Bayonet fighter was holding it like he would with a real one. Meaning, he does not slide the weapon, and maintained his grip throughout. Thus, in order to get nearer to hit his opponent, he would have to rely on footwork rather than just easily sliding the weapon only.
Ancient Chinese Martial Arts Manuals