When stocks are hurting, bonds look really attractive. But that doesn't mean you should dump your whole stock portfolio and run to their fixed income embrace at the first sign of trouble.

The overall stock market plunged 37% in 2008, enough to cut a $500,000 portfolio's value to just $315,000. Ouch. Some investors suffered even deeper losses, leaving many licking their wounds -- and wishing they'd been invested in bonds instead.

After all, bonds gained 26% in 2008, per Ibbotson data, and we're all after the highest returns we can get. So would bonds, or at least a greater proportion of bonds, have served you well? Check out these possible portfolio allocations, and the returns they would have produced in 2008:

Allocation

2008 return

100% stocks

(37%)

75% stocks, 25% bonds

(21%)

50% stocks, 50% bonds

(6%)

25% stocks, 75% bonds

10%

100% bonds

26%

Data: Ibbotson, via Martin Capital Advisors.

Clearly, you should have been in bonds, right? Well, yes -- in 2008. But when stocks do well, bonds often lag. For instance, in 2006, stocks gained 16%, while bonds gained 1%. In 2003, stocks gained 29%, while bonds gained 2%.

And sometimes both do well, like in 1995, when stocks gained 37%, while bonds rose 32%. The gains or losses are different each year. What should matter for your long-term planning is what's likely and probable. Over most 20- and 30-year periods, stocks beat bonds. Between 1926 and 2008, stocks averaged 9.6% annual growth, versus just 5.7% for bonds.

As we get closer to retirement, it can make sense to add bonds to our mix. But for money you won't need to tap for many years, stocks deserve more serious consideration. Even in down markets, many stocks won't lose as much as the market as a whole; some will even gain value:

Company

2008 return

Wal-Mart (NYSE:WMT)

20%

McDonald's (NYSE:MCD)

8%

IBM (NYSE:IBM)

(20%)

Oracle (NASDAQ:ORCL)

(22%)

Amgen (NASDAQ:AMGN)

24%

Procter & Gamble (NYSE:PG)

(14%)

Celgene (NASDAQ:CELG)

20%

Data: Morningstar.

Asset allocation is an important way to control risk while maximizing returns. While some of your investments will lose value over the short run, the long-term results of asset allocation show how useful it is as an investing tool.

Learn more:

Longtime Fool contributor Selena Maranjian owns shares of Procter & Gamble, Wal-Mart, McDonald's, and Amgen. Wal-Mart is a Motley Fool Inside Value pick. The Fool owns shares of Procter & Gamble, which is a Motley Fool Income Investor selection. Try any of our investing newsletters free for 30 days. The Motley Fool is Fools writing for Fools.