What was the best infantry throughout history?
The interesting part of this question is "compared to their historical period."
There is little question modern infantry, Americans in particular, benefit from all of history in terms of training and tactics. No matter how brave or tough you are, you can't compete with someone who has 2,000 years of refinement on you.
But compared to their historical period there are really only two units that were not only better, but outclassed their contemporaries.
#1 Gustavus II Adolphus, King of Sweden. He basically invented modern infantry. Before him the only units that used their mobility was cavalry. He had a standing professional army that was systematically trained and drilled. He invented rolling volley fire and, most importantly the concept of combined arms.
At the Battle of Breitenfield his infantry destroyed a superior, charging, cavalry force which had never been done before. There is infantry before Gustavus Adolphus which entrenched and/or stood and fought and infantry after him which used sustained rates of fire to repel infantry, used combined arms and invented the modern infantry battlefield after 1600.
#2. The Bersaglieri. What Adolphus created, the Italians refined. They took infantry mobility to an entirely new level. They were so well trained and hardy (their regulations forbade them to walk anywhere, they ran, in formation, even on parade, while playing instruments) that at the Battle of the Chernaya River they charged cavalry and routed them. That's a jaw dropping feat for Crimean war era infantry against cavalry who were expected to be suicidally brave (Charge of the Light Brigade and all that.) In WWI they were on bicycles to break trench stalemates.
In WWII Rommel said "The German soldier has impressed the world, however the Italian Bersagliere has impressed the German soldier" after the Bersaglieri had attacked an American armored division and overran it.
Other examples of infantry can be the finest of their class, but no others stand out as game changing as the two above. No opposing army could ever have stood against them because it wasn't just a change in tactics the way a phalanx was an outgrowth of the shield wall, it was a revolution in thinking about infantry's role in battle.
What made the Romans great was their reconceptualizing the relationship between apparently non-tactical skills and tactical skills, such as digging earthworks, making roads, etc. Their engineering dovetailed with their infantry tactics and they were the finest example of their era, but they didn't reinvent infantry's role and historically alter it.