Building a market-beating portfolio is no simple task. The vast majority of professional money managers actually underperform the S&P 500 on a regular basis. But the ones who manage to beat the market can be a great source of inspiration.

Karthik Sarma and David Shaw have accomplished that feat over the past three years, and both hedge fund managers were buying stocks in the second quarter. Sarma more than quadrupled his stake in Shopify (SHOP 1.11%), which now ranks as his fifth-largest holding, and Shaw more than quadrupled his position in Costco (COST 1.01%), which ranks as his 15th-largest holding.

Here's why these growth stocks are worth buying today.

1. Shopify: The leading e-commerce platform

Shopify simplifies commerce. Its software helps businesses manage sales across physical and digital stores, including online marketplaces like Amazon and Etsy, social media like Pinterest and ByteDance's TikTok, and direct-to-consumer websites. Shopify also provides services like payment processing, discounted shipping, and financing, but its most ambitious project is the Shopify Fulfillment Network (SFN).

On that note, it recently acquired Deliverr, a logistics provider that already delivers over a million orders per month for merchants on e-commerce sites like Amazon and Walmart. Shopify will blend its own warehouses and automation technology with Deliverr's predictive software and partner ecosystem (warehouses, carriers, and last-mile providers) to accelerate the buildout of the SFN.

Management expects the project to reach scale by 2024, enabling merchants to offer two-day delivery across the U.S. To that end, the SFN will make Shopify even more valuable to merchants by empowering them to compete with retail titans like Amazon.

Shopify has struggled this year as high inflation has curbed discretionary spending. Additionally, growth in online shopping has slowed as the social effects of the pandemic have faded, making comparisons with the prior year look particularly bad. To that end, Shopify's revenue rose just 16% to $1.3 billion in the second quarter, and it generated negative free cash flow of $137 million.  

Those results are certainly disappointing, but the long-term investment thesis remains unchanged. Shopify is the most popular e-commerce software vendor as measured by market presence and user satisfaction. Last year, it captured 10.3% market share in U.S. e-commerce sales -- second only to Amazon -- and it has continued to gain market share online and offline in the first half of 2022.

That puts Shopify in front of a tremendous market opportunity. By 2025, global retail e-commerce sales will surpass $7 trillion, and U.S. retail e-commerce sales (Shopify's largest market) will account for $1.5 trillion of that total, according to eMarketer. And with shares of Shopify trading at 8.1 times sales -- near its cheapest valuation in the last five years -- now is a great time to buy this growth stock.

2. Costco Wholesale: The world's fifth-largest retailer

Costco operates 829 warehouses around the world, the majority of which are located in the U.S. and Canada. Its membership-based business model and reputation for great prices have translated into significant brand authority, and the company currently ranks as the fifth-largest retailer in the world, according to the National Retail Federation.

Costco has distinguished itself through operating efficiency. The company carries just 4,000 stock keeping units (SKUs) on its shelves, compared to the 30,000 SKUs found at most supermarkets. That means suppliers are competing for limited shelf space, giving Costco purchasing power that translates into lower prices for shoppers.

Better yet, Costco offers a wide selection of private-label products, sold under the Kirkland Signature brand. By eliminating the middleman, Costco can undercut the price of alternative brands by 15% to 20%, according to CNN, while still earning higher margins.

Not surprisingly, the company has generated solid financial results on a consistent basis, and that trend continued in the most recent quarter, in spite of macroeconomic headwinds. Revenue rose 16% to $52.6 billion, and earnings jumped 11% to $3.04 per diluted share.

Going forward, Costco is well positioned to maintain that momentum. In the short term, high inflation could push more people to cut costs by paying up for a Costco membership. And in the long term, the company's strong private label and rigorous inventory management should keep it growing at a steady clip. That's why this growth stock is a smart long-term investment.