Millennials are doing lots of good work with our savings. We're saving earlier than our parents did. We're saving more too. All that despite making around 20% less than our parents did at the same age.

But there's one thing many of us are doing wrong: We're investing in the wrong things.

According to a recent survey by Bankrate, young adults favor cash (30%) and real estate (30%) over stocks (13%) as their preferred investment vehicle.

Investing in cash or real estate is a terrible idea. Here's why.

Risk vs certainty

My generation came of age during the Great Recession. So it's understandable that many fear the risks of the stock market. Investments gain and lose value on a daily basis, and too many of us remember watching our parents' hard-earned retirement savings slip away during the depths of the stock market collapse in 2008.

By contrast, cash provides certainty: It won't disappear overnight. And real estate investing is backed by big, tangible assets -- physical properties -- that seem more durable than an online brokerage account.

Historically speaking, both cash and real estate also provide another certainty -- the certainty of lower returns than the stock market. The problem with cash is that your ability to buy things with that cash -- your purchasing power -- does no better than keeping up with inflation. Even if a dollar today earns 1%-2% interest in a savings account -- virtually unheard-of these days -- it's still doing no better than keeping pace with price increases.

Real estate, by contrast, has historically outperformed inflation.

By a whopping 1% annually.

Contrast that with the stock market -- through all their hills and valleys, stocks have historically returned inflation + 6.6% annually.

So on the one hand you have the risk that your investments will decline precipitously on some years -- versus the certainty that your purchasing power won't significantly outpace inflation (and could even lose to it).

With that in mind, let's reframe risk here: If the true risk that you're looking to control for is the risk of not having enough, then I would submit that cash and real estate are far riskier than stocks. Put a different way, you're much more likely not to have enough over a long period of time with real estate or cash instead of stocks.

Taken as a whole, over a long time span, the stock market is a much surer ticket to long-term wealth than cash or real estate. Now, to be clear, that isn't to say that you should never buy a house or never keep cash around. You should still have a big emergency fund -- most folks recommend six months of expenses or so in cash for a rainy day. But putting your retirement savings into those investing vehicles is much less likely to give you the returns you need for your golden years.

The $1.4 million problem

Let's work the math with a hypothetical person. Let's say she graduates college at 22 and starts her first job at an annual salary of $40,000. She saves 10% of their income toward retirement in a tax-protected account every year, and she receives a 3% raise every year. Assuming a 2% inflation rate, cash returns in line with inflation, real estate returns 1% greater than inflation, and stock returns 6% above inflation, she would end up with this much at age 65:

By investing in cash: $498,302

By investing in real estate: $613,097

By investing in stocks: $2,056,503

Choosing stocks is worth an extra $1.4 million in savings compared to real estate, and over $1.5 million compared to cash.

Related links:

• Motley Fool Issues Rare Triple-Buy Alert

• This Stock Could Be Like Buying Amazon in 1997

• 7 of 8 People Are Clueless About This Trillion-Dollar Market

In fact, in some cases, this is understating what investors can achieve. Because these are average returns -- meaning that stock market investors who perform above the average can do even better.