The U.S. economy stunned analysts in the second quarter as gross domestic product increased at an annualized rate of 2.4%, an acceleration from 2% growth in the first quarter. That momentum was due in large part to a rebound in business investments, though increases in consumer and government spending also contributed.

An economy that's growing faster than expected is good news for investors, as it portends better-than-expected financial results for many companies, which could easily lead to share price appreciation in the near term. And that catalyst is only a part of the investment thesis for Roku (ROKU -10.29%) and Cloudflare (NET 1.44%).

Here's why these extraordinary growth stocks are worthwhile buys for patient investors.

1. Roku

Connected TV (CTV) ad spending will make up just 16% of total TV ad spend this year, according to media investment manager GroupM, but streaming services already account for about 38% of total TV viewing time. That discrepancy will undoubtedly resolve itself as advertisers shift their focus to CTV platforms in pursuit of consumers, and Roku is perhaps better positioned to benefit from that trend than any other company.

Roku is the most popular streaming platform in the U.S., Canada, and Mexico as measured by streaming hours, and Roku OS is the top-selling smart-TV operating system in the U.S. and Mexico, which implies a faster influx of new viewers compared to competing platforms.

In other words, Roku is running circles around its peers. That success hints at brand authority, a competitive advantage that should keep the company on the leading edge of the streaming industry.

The company impressed Wall Street with its second-quarter report, crushing expectations on the top and bottom lines. Revenue rose 11% year over year to $847 million on strong growth in active accounts and streaming hours, and Roku reported a slightly narrower loss of $108 million under generally accepted accounting principles (GAAP).

Better yet, CEO Anthony Wood reiterated earlier forecasts for positive adjusted earnings before interest, taxes, depreciation, and amortization (EBITDA) in 2024, a signal that the company is moving toward GAAP profitability.

Looking ahead, Roku has a great shot at accelerating growth as the economy improves and ad spending normalizes. CTV ad spend in the U.S. alone is expected to increase at an annualized 15% through 2030, according to BMO Capital Markets, and Roku should outpace the industry average given its leadership position.

And the company has an even bigger opportunity due to its foothold in Canada and Mexico, and its burgeoning presence in Europe and Australia.

Roku also has other irons in the fire. It recently launched a line of smart-home products (including video doorbells) that it plans to monetize with services like cloud storage, and it came out with higher-end Roku-branded smart TVs meant to complement more-affordable models from manufacturing partners. Those devices are ultimately intended to draw more people to the Roku platform, increasing its clout with advertisers, but they could also become modest revenue streams in their own right.

Currently, shares trade at 3.8 times sales, a discount to the three-year average P/S of 11.9. Investors should use that opportunity to buy a small position in this growth stock.

2. Cloudflare

Cloudflare offers a range of cloud services that improve the performance and security of business-critical software and infrastructure. It also provides developer services that help businesses build and deploy performance-enhancing applications.

The cloud computing industry is highly competitive, and Cloudflare is a fraction of the size of rivals like Amazon Web Services (AWS) or Microsoft Azure, but the company has still distinguished itself through engineering expertise and scale.

Cloudflare operates the world's fastest cloud network, and the combination of exceptional speed and freemium pricing has attracted a great many users. About 20% of the web runs on Cloudflare, and because it handles that much traffic, the company has unique insight into performance and security problems across the internet.

Those advantages have made Cloudflare a leader in several cloud verticals, including web application firewalls, email security, and zero-trust network access.

The company delivered solid results in the second quarter. Its customer count increased by 17% to 174,100, and the average customer spent 15% more. Revenue rose 32% to $308 million, easily outpacing AWS and Azure, and non-GAAP (adjusted) net income climbed to $0.10 per diluted share, up from breakeven in the prior year. The company also raised its full-year outlook modestly.

Looking ahead, Cloudflare puts its addressable market at $204 billion by 2026, and the company believes its growth will accelerate. Management expects trailing-12-month revenue to reach $5 billion by the third quarter of 2027, implying annualized growth of 42%. That makes its current valuation of 19.8 times sales look reasonable, and it's certainly a discount to the three-year average P/S of 41.4.

At that price, risk-tolerant investors should feel comfortable buying a small position in this growth stock today.