The S&P 500 is up by 16% year to date amid cooling inflation and stronger-than-expected economic growth. That leaves the broad-based index just 8% from a record high, which is the definitive threshold for a new bull market.

Whether the index hits that mark next week, next month, or next year, history makes one thing clear: The next U.S. bull market is coming. The S&P 500 has never failed to recoup its losses in the past, and every U.S. bear market has eventually been followed by a bull market. Investors have no reason to expect a different outcome this time.

The S&P 500 returned an average of 184% during the last 10 bull markets, and many stocks will soar during the next one. Investors should be able to catch a piece of that momentum by buying Roku (ROKU -10.29%) and Datadog (DDOG 4.95%).

1. Roku

Roku has carved out a strong position in streaming entertainment. It ranks as the most popular streaming platform in the U.S., Canada, and Mexico as measured by viewing time, and Roku products account for 50% of all streaming devices in North America. Its two closest competitors -- Samsung and Amazon -- hold a 34% market share between them. In short, the Roku brand carries weight with consumers.

Investors can attribute that brand authority to product differentiation. The Roku OS is the only operating system purpose-built for connected TV, and purpose-built products tend to provide better user experiences. Even so, Roku has struggled in the past year as companies have slashed their ad budgets in anticipation of challenging economic conditions. That headwind continued to suppress growth in the second quarter.

Revenue climbed 11% in Q2 to $847 million, a deceleration from 18% growth in the prior-year period. But the company still made progress on the bottom line as management prioritized efforts to cut its own spending. Roku reported a net loss of $0.76 per diluted share, an improvement from its loss of $0.82 per diluted share a year earlier.

Revenue growth should accelerate naturally as the ad industry recovers, but Roku is also working to make its platform more appealing to advertisers by boosting viewer engagement. For instance, the company is investing in content for The Roku Channel, its free ad-supported service, and those investments appear to be paying off. The Roku Channel ranked among the top five channels on the platform in the second quarter, and accounted for 1.1% of all streaming time in the U.S. in July. That puts it on par with Comcast's Peacock and ahead of Paramount Global's Paramount+.

With that in mind, BMO Capital Markets analyst Daniel Salmon says connected TV ad spending in the U.S. alone will grow at an annualized rate of 15% to $100 billion by 2030. Roku should be able to match that growth rate at a minimum, given its strong position in streaming media. That makes its current valuation of 3.5 times sales appear quite cheap, especially compared to its three-year average of 11.7. Investors should buy a small position in this growth stock today.

2. Datadog

Datadog provides observability and security software to development, operations, and security teams. Its platform collects data from every system and service to provide real-time visibility at every layer of the technology stack, which helps businesses keep their applications and infrastructure secure and functioning well.

Industry analysts have praised Datadog for its innovations across multiple observability verticals. IT consultancy Gartner recently recognized the company as a leader in application performance monitoring, and Forrester Research recognized its leadership in artificial intelligence for IT operations. Additionally, research company G2 ranks Datadog as a leader in log monitoring, network monitoring, and server monitoring.

Growth decelerated in the second quarter as businesses continued to scrutinize their spending decisions amid a complex economic environment, but Datadog still delivered a reasonably strong financial report. Its customer count increased 23% to 26,100, and its average customer spent in excess of 20% more year over year. In turn, revenue climbed by 25% to $509 million, and free cash flow soared by 135% to $141.7 million. Investors have good reason to believe that momentum will persist.

Datadog has innovated like clockwork throughout its history. After becoming the first software vendor to unify the three pillars of observability (metrics, traces, and logs) on a single platform in 2018, Datadog delved into user experience monitoring in 2019, incident management and cloud security in 2020, data privacy and database monitoring in 2021, compliance reporting and cloud cost management in 2022, and large language model monitoring in 2023. That rapid product development cadence should keep the company on the cutting edge of the observability industry.

Meanwhile, cloud migration and other digital transformations will continue to make corporate IT environments more complex, increasing the need for observability and security software. Management says that tailwind should drive its market opportunity to $62 billion by 2026, up from $41 billion in 2022.

On that note, the shares currently trade at 16 times sales, a bargain compared to their three-year average of about 36 times sales. Investors should feel comfortable buying a small position in this growth stock right now.