Even as the S&P 500 and the Nasdaq Composite dipped into a bear market this year, some of the smartest hedge fund managers out there weren't dissuaded and kept buying growth stocks eagerly. Karthik Sarma of SRS Investment Management took a stake in Shopify (SHOP 0.28%) in the first quarter, and he built it into his fifth-largest position by the end of the third quarter. Meanwhile, David Shaw of D.E. Shaw & Company more than doubled his stake in The Trade Desk (TTD 3.09%) since the first quarter.

What makes Sarma and Shaw smart? The funds these two hedge fund managers oversee both outperformed the S&P 500 over the past four years, putting them in rarefied air. Individual investors should follow their lead and buy these two growth stocks before the next bull market. Here's why.

1. Shopify: The leading e-commerce software company

High inflation hit retailers from multiple angles this year. Rising prices simultaneously slowed consumer spending and turbocharged operating costs, putting pressure on Shopify's top and bottom lines.

In the third quarter, revenue increased just 22% to $1.4 billion, and the company reported an adjusted loss of $0.02 per share, down from an adjusted profit of $0.08 per share in the prior year. But the tough economy is a temporary problem, and Shopify is in great shape to reaccelerate growth when inflation moderates.

The bull case is straightforward: Shopify simplifies every aspect of commerce, from marketing and inventory management to payments and order fulfillment. Its software integrates with online marketplaces like Amazon and social media like Meta Platforms' Facebook, and it also syncs with brick-and-mortar shops and direct-to-consumer (D2C) websites. That gives Shopify an edge over retailers like Amazon and Walmart, and its robust product offerings propelled the company to the forefront of the industry.

In fact, Shopify is the most popular e-commerce software vendor in terms of market presence and user satisfaction, according to software research company G2. That brand authority should help it capitalize on its large addressable market: Retail e-commerce sales are forecast to increase by 14% annually to reach $15 trillion worldwide by 2030.

Management outlined an ambitious growth strategy, part of which involves building a nationwide fulfillment network to democratize logistics for D2C businesses. The Shopify Fulfillment Network will support two-day delivery to buyers across the U.S., meaning sellers will be able to guarantee fast shipping across multiple sales channels (D2C, social media, and online marketplaces). No other e-commerce company offers that flexibility

Currently, shares trade at 8.4 times sales, a steal compared to the three-year average of 35.5 times sales. That's why this growth stock is worth buying today.

2. The Trade Desk: The leading independent platform for ad buyers

The Trade Desk is an ad tech company. Its demand-side platform (DSP) leans on artificial intelligence (AI) to help marketers plan, measure, and optimize data-driven ad campaigns across digital channels. The Trade Desk engineered its DSP on bid factors, a unique technology that makes it easy for marketers to set very expressive targeting parameters, and better targeting translates into better campaign results. No other DSP incorporates bid factors.

The Trade Desk is also an independent ad tech vendor, meaning it does not own any web properties or sell any ad inventory. That eliminates that conflict of interest inherent to advertisers like Alphabet, which has a clear incentive to steer ad dollars toward Google Search and YouTube. In a nutshell, The Trade Desk offers its clients more transparency, and that advantage has kept its customer retention rate above 95% for eight consecutive years.

Many brands cut their ad budgets in response to softening consumer demand, and several ad-based businesses struggled of late. In the third quarter, Alphabet reported growth of 6%, while Meta Platforms saw sales decline by 4%. But The Trade Desk remained resilient. Its third-quarter revenue soared 31% to $395 million, and adjusted earnings increased 44% to $0.26 per diluted share. Better yet, investors have good reason to believe that momentum will continue.

According to eMarketer, worldwide digital ad spend is forecast to grow by 10% annually to reach $876 billion by 2026. The Trade Desk -- as the leading independent DSP -- is already well positioned to capitalize on that opportunity, and its capacity for innovation should give investors additional confidence. For instance, The Trade Desk launched Solimar last year, a platform upgrade featuring "industry leading AI" and the "world's most advanced data marketplace," according to CEO Jeff Green. Those tools help marketers spend ad dollars more effectively.

Currently, shares trade at 14.9 times sales, a bargain compared to the three-year average of 30.5 times sales. That's why this growth stock is a smart buy before the ad industry rebounds during the next bull market.