Stocks can swing unpredictably in the short term, as we were reminded last year. But what builds lasting wealth in the stock market is holding a group of companies with above-average growth prospects for many years, letting compound interest transform your savings into a mountain of cash.

Advanced Micro Devices (AMD 1.33%) and Cloudflare (NET -1.05%) are leaders serving important technological trends in advanced computing and internet security that are poised to deliver big gains. Here's what you need to know.

1. Advanced Micro Devices

Share prices of Advanced Micro Devices are trading down 41% from the previous high. While revenue from this semiconductor company was better than expected in the company's first-quarter earnings report, AMD experienced slowing demand for chips across the enterprise and the consumer spaces. But the long-term tailwinds in the markets AMD serves are much more powerful than the near-term economic headwinds.

AMD supplies high-powered chips for data centers, video game consoles, and consumer PCs. It also now serves a burgeoning market of edge computing devices (e.g., connected vehicles and the Internet of Things) following last year's acquisition of Xilinx. 

In the data center business, Microsoft Azure, Alphabet's Google Cloud, and Oracle Cloud are expanding their use of AMD's EPYC processors for new virtual servers in the cloud (public cloud instances). The largest cloud providers launched 28 new instances in the quarter, bringing the total number of AMD-powered public instances to over 640. 

AMD still expects revenue in the second quarter to be down 19% over the year-ago quarter, but revenue is already showing signs of stabilizing. Guidance calls for revenue to be approximately flat in the second quarter over the first quarter, and management sees stronger demand coming in the second half of the year.

Chart showing AMD's quarterly revenue.

Image source: Advanced Micro Devices.

AMD is on track to launch its first cloud-native server chip (Bergamo) this quarter, in addition to its fourth-generation EPYC processor (Genoa). Management sees these launches leading to strong demand in the second half of the year. 

Management also sees improving demand on the consumer side. One bright spot in the last quarter was revenue growth in AMD's semi-custom system-on-chip business, driven by strong demand for video game consoles. Management also believes the first quarter was the bottom for the client processor business, which includes chip sales for consumer PCs. 

Long-term, AMD is also starting to position itself for the rapid adoption of AI, which is the company's top priority right now. The market looks at AMD's lack of exposure to the AI trend as a handicap, which is why the stock trades at a discounted price-to-earnings (P/E) ratio compared to rival Nvidia. But investors who look at the long-term potential of this well-managed business under CEO Lisa Su are getting a relative bargain.

AMD PE Ratio (Forward) Chart.

Data by YCharts.

2. Cloudflare

Cloudflare is another tech leader with an attractive long-term opportunity. In this case, the opportunity is the growth of content delivery networks (CDNs), which are local data servers that are positioned close to end users. By handling internet traffic closer to the user, companies can deliver content at faster speeds while guarding against malicious attacks. CDNs handle the majority of internet traffic today, and Cloudflare is one of the leading network providers.

The stock is down 17% since the company's first-quarter report. Investors can blame the stock's expensive P/E ratio for the stock's collapse.

The dip is a great buying opportunity ahead of more growth over the next several years. The company reported revenue growth of 37% year over year in the first quarter. Management noted record-high win rates against competitors. 

Another reason to buy the stock is improving profitability. Profit margin has remained below breakeven as management invests to grow the business. However, management's 2023 guidance calls for adjusted income from operations to be between $73 million to $77 million, or $0.34 to $0.35 per share.

As they say, stocks follow profits (or lack thereof) over the long term, and Cloudflare should have plenty.

NET Profit Margin Chart.

NET Profit Margin data by YCharts.

Beyond 2023, earnings per share should grow substantially. This is fundamentally a very lucrative business model since Cloudflare sells its network services as a subscription. It offers its basic service for free, but its Pro and Business plans range from $20 to $200 per month. There's also an enterprise-grade service, which can cost thousands per month. 

In the last quarter, Cloudflare added 114 new large customers that pay more than $100,000 per year for network services. That brings the total large customer count to 2,156, an increase of 40% year over year.

However, management sees a lengthening sales cycle due to economic uncertainty. Full-year revenue is expected to be up 31% at the midpoint of guidance. But this is why investors can buy the stock at more attractive prices. When business conditions are better, stocks like AMD and Cloudflare won't be cheap.