Smart investors know the stock market is a long term game, and trying to seek out companies that can double your money in just a few years time is a fool's errand. Anything can happen in the short run to upset the best laid plans, but over the longer term, the cream will rise to the top and the best companies will shine.

Rising 3-D stock chart with finger pointing to dollar signs

Image source: Getty Images.

Still, sometimes top stocks also perform remarkably well for investors in the near term. Here are three examples of companies that have doubled investors money -- not over five, 10, or 20 years, but in just three years time! $5,000 invested in these stocks in 2014 would be worth $10,000 or more today. That's a result few investments are able to replicate.

Moreover, these aren't super-risky penny stocks, but rather members of the S&P 500 index, meaning they're among the biggest companies on the market today.

1. Ulta Salon

Beauty care and products are fashion statements, and no cosmetics company has made a bigger or bolder statement in recent years than Ulta Salon (ULTA -2.32%), which sells more than 20,000 products from 500 vendors at almost 1,000 stores. It has become the industry leader not just because it sells more stuff than the competition, but because it combines a broad selection of products in a unique salon environment that can't be easily replicated, especially by online retailers.

While e-commerce has drained market share from any number of bricks-and-mortar retailers, causing them to close stores and shrink their square footage, Ulta brashly proclaims it will maintain its breakneck expansion pace. By the time it reports its fourth-quarter earnings, it will have opened 100 net new stores in 2016 and grown its square footage by 11% over the prior year.

Redone beauty products on display at Ulta Salon

Image source: Ulta Salon.

Cosmetics is certainly a crowded space, and consumers can purchase cheaper products from their local drugstores. The allure of the space has even tempted fast-fashion leader H&M to enter the market with its own discounted line. But when it comes to personal beauty care, consumers are increasingly unwilling to skimp on quality, and Ulta Salon's business model of selling them in a salon setting where professional beauty care specialists can provide instant advice and feedback is one reason it has generated returns totaling nearly 217% over the past three years.

2. Broadcom

The Broadcom (AVGO 1.35%) of today isn't the fabless semiconductor company of years past. In 2016, it was acquired by Singapore-based Avago Technologies for $37 billion, which renamed itself Broadcom Limited, but to spice things up kept the AVGO ticker symbol. Once the merger was complete, it sold its entire Internet of Things portfolio of products to Cypress Semiconductor for $550 million. Today, the resulting company describes itself as "a leading designer, developer and global supplier of a broad range of digital and analog semiconductor connectivity solutions that serve the wired infrastructure, wireless communications, enterprise storage and industrial markets." A full plate, to be sure.

Group of young people on their smartphones, laptops, and tablet computers

Image source: Getty Images.

Yet the Reader's Digest version of that is Broadcom is primarily a supplier of chips to smartphone and tablet producers, especially Apple (AAPL -1.84%), which accounts for more than 10% of its sales, but also likely Samsung, which helps explain why its stock has done so well over the past few years.

Since 2014, Broadcom's stock has returned more than 276%, meaning a $5,000 investment then would now be valued at almost $14,000, a near three-bagger.

Its success in the mobile market -- the company is generating revenues of $13 billion annually -- meant that it could afford to sell off a small business like its IoT portfolio (which made less than $200 million) without thinking twice, even as its rivals are racing headlong into the space. Being a key supplier to the mobile market should allow it to continue generating big returns.

3. NVIDIA

Ulta and Broadcom may have done well for investors over the past few years, but their gains pale in comparison to the returns NVIDIA (NVDA 1.98%) has generated. Rising about 600% in value since 2014, the graphics chipmaker would have turned a $5,000 investment into about $35,000.

Man wearing virtual reality goggles watching light painting

Image source: Getty Images.

NVIDIA was able to post such remarkable results because it has its finger on the pulse of all the technologies that are driving into the future in sixth gear. From artificial intelligence and self-driving cars to augmented and virtual reality -- not to mention its bread-and-butter gaming markets, which almost all the other advances are tying into -- NVIDIA is making the chips that power the newest devices.

We'll be seeing soon how its fourth quarter played out, but if it continues to follow the pattern from its third quarter, it will be one to look forward to. Last quarter, NVIDIA revenues surged 54% year over year to $2 billion, and the company predicted it would grow another 50% in Q4. Analysts who were caught flat-footed by how will the third quarter played out have upped their forecasts for an equally robust consensus view of the fourth.

While its three-year results have been impressive, most of the gains came in the last year, and a stock that rises so far so fast can be ripe for a correction. Not that it won't continue higher, but if it takes a pause before it soars once again, investors probably shouldn't be surprised. And grow it should, since industry analysts see the A.I., V.R., and driverless car markets becoming huge in the near future.