If you bought $1,000 worth of Walmart (WMT 0.18%) shares five years ago, in mid-April, 2019, how much would that be worth today? The answer is: $1,863.

That answer alone isn't sufficiently informative, though. Consider, for example, that it does not reflect the reinvestment of dividends. If you'd reinvested your Walmart dividends into additional shares of Walmart stock, you'd have ended up with $1,904, a little more. (Walmart's dividend recently yielded 1.4%. That's not huge, and it's not growing too quickly. Over the past five years, Walmart's dividend has increased at an average annual rate of just 3.3%.)

Here's another consideration: It's worth comparing Walmart's performance to that of a large-cap benchmark, such as the S&P 500 index -- because if you're not outperforming a benchmark over long periods, you'd be better off just investing in the benchmark. (In this case, an S&P 500 index fund such as Vanguard S&P 500 ETF would fit the bill.) Over the past five years, Walmart did outperform the S&P 500, but not by much. Walmart averaged annual gains of 13.24% (without reinvesting dividends), versus 13.01% for the S&P 500. With dividends reinvested, the outperformance is 13.73% versus 13.52%, respectively.

Looking back to see how Walmart has performed in the past is certainly interesting, but it's much more important to have an idea of how the stock will perform going forward, as that can inform a decision to buy or sell. The stock's valuation isn't compelling at recent levels: Its recent price-to-sales ratio of 0.75 is above the five-year average of 0.68, and its forward-looking price-to-earnings (P/E) ratio of 25.4 is above the five-year average of 23.3.

So don't rush to buy Walmart stock right now, but if you're bullish on its future, you might wait for a better, lower entry price. Alternatively, consider just sticking with a simple, low-fee S&P 500 index fund.