With the cryptocurrency crash, China trade war, and the quickly changing technology landscape, NVIDIA (NASDAQ:NVDA) and Advanced Micro Devices (NASDAQ:AMD) have had a volatile 2019. But by staying focused on research and development, their futures are more promising than ever -- in entirely different ways.

Advanced Micro Devices challenges a giant

AMD's stock price has gone on an amazing run. Within the last six weeks, it gained about 45%. At this point, the shares are close to a 13-year high.

With the stock market trading at all-time highs as well, should you buy the stock, hold on if you have it, or take some profits? Let's think about this.

This year, AMD improved its Ryzen processor and went after the CPU market share of Intel (NASDAQ:INTC). The risk is paying off. While AMD's third-quarter revenue increased 9% year over year, Intel's remained flat. AMD guidance indicates higher fourth-quarter revenue. Analysts on average expect 27% growth for the company in 2020, versus a 2% gain for Intel. 

Graphic showing chip architecture

Image source: Getty Images.

Intel knew it needed to raise its game -- then experienced prolonged product delays, necessitating apologies to PC customers for shortages of CPU chips. 

Advanced Micro Devices capitalized on Intel's stumbles and is not looking back. The company has a clear opportunity to grow and is an attractive investment choice in the tech space. But is it the right choice at the right time, given valuation?

Analysts aren't so sure; their average price target is $35. 

AMD's business, like that of most other semiconductor companies, is very volatile, especially with the trade war. But the company has been hitting all the right notes, soaring 114% this year. This compares with the iShares PHLX Semiconductor ETF (NASDAQ: SOXX), which is up 57%. 

NVIDIA gets around the China trade war

NVIDIA (NASDAQ:NVDA) has had a wild ride of a year, as the trade war and the cryptocurrency crash caused sharp downdrafts, followed by developments in artificial intelligence (AI) and machine learning that made the stock price spike. Overall, shares have rebounded about 60% in 2019.

CEO Jensen Huang sees amazing times ahead as the company positions itself in the center of the Internet of Things. Its new EGX Edge Supercomputing Platform, a cloud-based product merging AI and 5G networks, allows companies and cities to access data-center processing at lightning speed.

NVIDIA sidestepped China trade issues by partnering with Ericsson (NASDAQ:ERIC), a Swedish company and leader in building high-speed wireless networks, to construct the EGX Edge Platform. Together, the companies are fusing 5G, supercomputing, and AI for a groundbreaking communications platform that can someday support trillions of always-on devices. 

The partnership is key to relationships with large telcos, which must remain neutral in the trade war but want the technology. Forging this alliance means the project can move forward much more quickly.

NVIDIA's stock price has scored a big run this year, and investors may wonder if they have missed the boat. The timeline is the crucial factor.

Near term, the road may be a bit bumpy. NVIDIA forecasts revenue between $2.89 billion and $3.01 billion for the current quarter, below analysts' expectations. 

For those with a longer time horizon, it could be a great choice among chip stocks. Besides growth opportunities in data centers and gaming, NVIDIA has emerged as a top competitor in AI and autonomous driving.

Morgan Stanley analyst Joseph Moore acknowledged NVIDIA's current high valuation but increased his price target from $217 per share to $259. "All semiconductor stocks are at a premium multiple on 2020 earnings," Moore said, "but across the group, we see NVIDIA as having one of the best opportunities to maintain a high multiple as we shift to 2021." 

Which is the better investment today?

The semiconductor space has not been for the faint of heart this year, and a lot of questions remain. The valuations look rich, but the prospects for growth look enormous, too.

Advanced Micro Devices and NVIDIA are both excellent companies that have continued innovating and found ways to distinguish themselves on the cutting edge.

I like them both as promising choices for investors who are comfortable with some market turbulence. More-conservative investors might wait for pullbacks -- but run the real risk of missing a breakout run for either company.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.