Whales evolved explosively fast into a spectacular array of shapes and sizes, a new study suggests.

Whales' sizes stretch the imagination from the 100-foot (30-meter) long blue whale — the largest animal to have ever existed — to a small species about the size of a dog. Many ideas exist for how whales evolved into different body types, but the new study, published online in the May 19 edition of the journal Proceedings of the Royal Society B, is the first attempt to unravel the mystery.

"It's as if whales split things up at the beginning and went their separate ways. The distribution of whale body size and diet still correspond to these early splits," said evolutionary biologist and study co-author Michael Alfaro of UCLA. "Our study is the first to test the idea that evolution in early whales was explosively fast."

Around 35 million years ago, when modern whales began to appear in the ocean, whale evolution ignited. Whales began as basically similar body types and evolved into everything from porpoises to blue whales over the next 5 million years, said study lead author Graham Slater of UCLA.

"Five million years is like the blink of an eye," Slater told LiveScience.

The finding supports what's known as the explosive radiation hypothesis. The idea is that a few key traits allowed the earliest ancestors of modern cetaceans — marine mammals, including whales, dolphins and porpoises — to explore new ways of living. Once these ancestors branched out into a new body form, they stayed the course.

The key traits credited with the explosive evolution include sonar, large brains, baleen (the stringy looking stuff across some whales' mouths that filters small animals from sea water), and complex sociality.

Looking back 35 million years, to when the ancestor of all living whales appeared, Alfaro and colleagues analyzed the evolutionary tempo of modern whale species and probed how fast whales changed their shape and body size. The research team analyzed DNA sequences and studied the fossil record to figure out when major groups of whales appeared and when they became dominant.

The "variation that we see in modern whales today is the result of partitioning of body sizes early on in their history," Alfaro said. "Whatever conditions allowed modern whales to persist allowed them to evolve into unique, disparate modes of life, and those niches largely have been maintained throughout most of their history."

Historically, not all of these remarkably diverse body plans were successful. Today, 84 living species of whales roam the oceans, while more than 400 other species are known to have gone extinct, including some that lived partly on land.

Archaic whales appeared around 55 million years ago, eventually entering the ocean and filling a void left by ancient ocean-dwelling reptiles that went extinct. These primitive whales, now extinct, ranged in size from a few feet in length to as large as 65 feet (20 m) long.

Large whales, small whales and medium-size whales all appeared early in the history of whales, with the large whales eating mostly plankton, small whales eating fish, and medium-size whales eating squid.

"Those differences were probably in place by 25 million years ago, at the latest, and for many millions of years, they have not changed very much," Slater said.