In looking into crystal balls for 2009, Wall Street analysts who cover the food industry were in accord on one point last December — food shares would underperform by a significant margin if the overall stock market rallies this year. This prediction, based on the idea that investors would move away from defensive sectors like food if they see an economic recovery on the horizon, has proven accurate.

With the Dow Jones average of industrial shares topping 10,000 last week for the first time since October 2008, grain-based foods shares have lagged considerably. Through Oct. 15, the Grain-Based Foods Share Index had climbed 12% in 2009, behind the D.J. index which was up 19% and the S&P 500, up 27%.

The grain-based shares underperformance largely, but not completely, erases the outperformance last year when grain-based shares fell 21%, versus a 34% drop in the D.J. index and a 39% drop in the S&P.

Within the grain-based foods shares, every U.S.-based company has seen a share price increase but with tremendous variation. The largest gains were posted by companies that had sustained some of the widest declines in 2008 and earlier. Shares of Krispy Kreme Doughnuts Inc. were up 139% through Oct. 15; Tasty Baking Co., up 98%; and Sara Lee Corp., up 18%. Eighteen of the 25 companies in the index have seen share gains in excess of 10%. The smallest changes were advances by shares of Kraft Foods Inc. and Flowers Foods Inc. each up less than 1%. Kraft weighs heavily in the grain-based index, so its underperformance and Flowers’ may suggest that the upside potential for the index in 2009 remains considerable.