When dinosaurs went extinct, they left big shoes to fill in pretty much every ecosystem on our planet. Even without feet, snakes stepped up to the challenge.

Shortly after the asteroid impact, some 66 million years ago, new models suggest several slithery survivors quickly slid into the uncontested space. The dominance of dinosaurs had come to an end, and it was time for birds, mammals and legless reptiles to explode.

"So impressive was the diversification of mammals that the Cenozoic is commonly referred to as the 'Age of Mammals'," researchers write in a new paper on the subject.

"With nearly as many species of snakes as there are mammals, however, the Cenozoic might just as well be called the 'Age of Snakes'."

Today, there are nearly 4,000 different species of snake. Where this huge diversity came from, when, and why, are questions that scientists are still trying to figure out.

Snakes are very rare in the fossil record, and those alive today are shy and secretive, which makes it difficult to gather data. Historically, these creatures have also been overlooked by scientists in favor of warm-blooded organisms more similar to ourselves.

Unfortunately, the sheer lack of information means our models of snake evolution contain a whole lot of uncertainty.

The new model tries to account for gaps in our knowledge as much as possible. It compares published data on 882 living snake species to the stomach contents of preserved museum specimens.

This is the first time stomach data have been incorporated into the evolutionary analysis of snakes, and while there's still a long way to go (the data include less than a quarter of all described snake species), the findings suggest animal lineages will quickly diverge if given the ecological opportunity.

The result is a burst or 'explosion' of diversity, which then gradually slows down as a niche in the ecosystem grows saturated.

According to the new model, ancestral snakes seem to have been narrowly specialized in what they could and couldn't eat even before the dinosaur extinction. In fact, the most recent common ancestor of all snakes alive today most probably fed on invertebrates, like insects.

Only after the asteroid impact killed off most of the non-avian dinosaurs, did snakes begin to branch out and try new flavors. The new model suggests most snakes alive today originated from a lizard-eating ancestor in a relatively brief period of time, although the exact timing will continue to be hotly contested.

While the new research predicts snakes exploded in diversity right after the dinosaur extinction event, other models suggest this happened millions of years later, during a smaller extinction event in the Eocene.

"The thing is, either way you look at it – their tree, or our tree – the vast majority of snake diversification is arising after the asteroid impact," evolutionary biologist Nick Longrich, who authored his own models not too long ago, told ScienceAlert.

"Is that happening immediately after the asteroid (as they suggest) or is a lot of this only happening millions of years later, after this second extinction? Their diversity is pretty recent any way you look at it, but just how many species survived, just which groups radiated when… we're probably going to be working that out for years to come."

Snakes, it seems, have a special way of twisting and turning to fit themselves into just about any ecological position.

Overall, they manage to eat a huge variety of diets, even as some species have ended up specializing to the extreme. For instance, some snakes today need particular venom for the type of prey they hunt, while others require unique teeth and jaws to swallow their victims.

Whether this diversity in diet exploded shortly after the dinosaur extinction or millions of years later, it appears ancient snakes had the ability to alter their predatory behaviors with remarkable flexibility.

During the Eocene, for instance, when small mammals were taking off, the new models suggest the most recent ancestors of vipers, boas and pythons were already highly specialized to eat rodents. Whether that's the oldest example of rodent-eating among snakes, however, is limited by our selection of fossils.

"We find a major burst of snake diet diversification after the dinosaur extinction, and we also find that, when snakes arrive in new places, they often undergo similar bursts of dietary diversification," explains evolutionary ecologist Michael Grundler from the University of California, Los Angeles.

Colubroids, for instance, are the largest family of snakes today, including the boomslang, whipsnakes and the brown tree snake, and they are found on every continent except for Antarctica.

After this family's initial explosion early on in the Cenozoic, the new model suggests its members continued to colonize North and South America, causing further bursts of adaptive evolution.

One population of colubroid in the Galapagos, for instance, figured out how to hunt for fish along the coast, which is a highly specialized behavior not noticed in other close relatives.

Perhaps it is the adoption of special hunting behaviors like this that has ultimately driven the evolution of niche diets in the snake lineage.

That's interesting, because it's often assumed that dietary generalists are much better at coping with changing ecological conditions, whereas specialists are more constrained in what they can and can't do to survive.

"It's clearly the case that specialization is not disadvantageous," Grundler told ScienceAlert.

"And one insight to come from analyzing all these firsthand diet observations is that even apparent specialists branch out occasionally. Perhaps those rare sources of ecological variation are what allow snakes to continue innovating over the long run."

The study was published in PLOS Biology.