2018 was a pretty good year for NVIDIA (NVDA 0.90%). The global economy was chugging along, the company announced its next-gen RTX 20 series video cards (the first ever to enable real-time ray tracing in video games), and NVIDIA's small data center business was expanding at a rapid pace. If you'd invested that summer three years ago, however, your timing would have seemed terrible based on what happened over the next couple of months. 

Starting in late 2018, a confluence of events worked against the leading graphics processing unit (GPU) designer. The U.S.-China trade war heated up and complicated supply chains for chip companies, a global oversupply of chips started to crop up, and the price of bitcoin (BTC -0.04%) tanked along with other cryptocurrencies. NVIDIA stock ended up tanking too, ultimately falling as much as 55% from its late-summer 2018 peak.

However, if you bought $5,000-worth of NVIDIA stock three years ago -- just before its crash -- you'd still have turned a tidy profit. 

Someone monitoring their GPU cryptocurrency mining rig.

Image source: Getty Images.

Imperfect timing yields a nearly-38%-per-year return

If you had the worst timing ever and bought NVIDIA on October 1, 2018, and endured the over 50% drubbing that followed through the first half of 2019, you'd still be up just over 160% as of July 15, 2021. That's almost a 38% per-year average return over the last three-year stretch. If you had originally bought $5,000 of NVIDIA stock, it'd be worth about $13,000 today, excluding dividend payments. 

For the sake of comparison, the S&P 500 Index (^GSPC -0.95%) has returned just 49% over the same period, and the PHLX Semiconductor Sector index 120%. 

Every stock has its dog days

There are powerful lessons contained here. As dominant a semiconductor industry player as NVIDIA has been, it's not perfect. Every growing company goes through tough stretches. So while paying a fair price for a stock is important, your timing doesn't need to be perfect if you're eyeing the long-term potential. 

As for NVIDIA in particular, the crypto crash was a learning experience. The company lacked visibility on how many cryptocurrency miners were purchasing its video game cards, and when the market dried up, its sales unexpectedly took a tumble. Since then, it's made some adjustments to its product portfolio to make sure gaming GPUs end up in the hands of gamers. 

NVIDIA didn't let the stumble sidetrack it from its goals either. While cryptos were a nice add-on to business a few years ago -- and have been again over the last year even though cryptocurrency prices took a steep nosedive again this spring -- data centers have been a primary focus for NVIDIA for some time. NVIDIA has since acquired Mellanox to boost its presence here and has steadily released new chip types aimed at scooping up a share of these modern computing units that enable cloud computing. Three years ago, its data center business hauled in about $2.9 billion in sales. Today, NVIDIA most recently reported that the same segment is worth about $7.6 billion in trailing 12-month sales.

This is all timely information to think about because a similar situation could be shaping up for NVIDIA now. Chip sales are booming this year, and sooner or later supply will catch up to demand. The crypto market crashed again, yet NVIDIA stock is near all-time highs, running up most recently because of the upcoming stock split. If you buy right now, your timing may not be perfect. But it doesn't need to be. NVIDIA is gobbling up a share of the semiconductor market through innovation and is poised to continue growing for many years to come.