By delivering a consistently positive shopping experience for their customers, both Starbucks (NASDAQ:SBUX) and Ulta Beauty (NASDAQ:ULTA) have managed to continue growing despite a recent slowdown in the broader retailing industry. Yet investors aren't particularly excited about either business today. Each stock is roughly flat over the past year, compared to a double-digit rise in the S&P 500.

So let's stack the two onetime Wall Street darlings against each other to see which might make the better buy.

Starbucks vs. Ulta Beauty stock

Metric

Starbucks

Ulta Beauty 

Market cap

$84 billion

$16 billion

Sales growth

5%

16%

Net profit margin

13%

8%

Dividend yield

1.7%

N/A

Price-to-sales ratio

3.9

3.2

Price-to-earnings ratio

29

36

52-week stock performance

3%

3%

Data source: Company financial filings and S&P Global Market Intelligence. Sales growth is for stores open at least one year.

Expansion trends

In terms of growth, Ulta Beauty has Starbucks -- as well as most other retailers -- beat by a wide margin. The spa services and beauty supply shop enjoyed a 16% spike in comparable-store sales last year. 2016 also marked its third straight year of accelerating growth by that metric.

Rising average spending played a role in those gains, but Ulta Beauty is winning most of its revenue growth the hard way: through increased customer traffic. The company posted an 11% traffic spike last year and began 2017 with another impressive boost, of 9%.

Starbucks, in contrast, has seen its expansion pace decelerate over the past few years, with traffic growth falling to 1% in 2016 from 3% in the prior year. The coffee titan even dipped into negative territory at the start of 2017.

Chart showing declining traffic growth.

Data source: Starbucks financial filings. Chart by author. *2017 covers the past two quarters.

Executives believe an expanded lunch menu will help the second half of the year show much stronger gains, but even a sharp rebound will leave Starbucks well below Ulta Beauty's expected 10% annual comps spike.

Profit and profitability

On the other hand, Starbucks has far greater earning power. Operating income spiked higher by 16% last year as the company executed well across a wide range of profit-boosting initiatives. These included expanding food as a percentage of sales, leveraging an extremely popular loyalty program, and marketing packaged goods to retailers.

Ulta Beauty is improving its profitability, too, with net margin creeping up to 8.4% of sales from 7.9% two years ago. And there's room for that figure to improve from here, especially if customer traffic gains continue at a healthy pace. Still, the retailer can't hope to reach the profitability that Starbucks has earned through decades of investing in its global brand.

Starbucks coffee pods

Image source: Starbucks.

Looking ahead

That valuable brand provides Starbucks a wide selection of paths to long-term growth, likely led by an international expansion that's set to boost the store base by 50% over the next few years. Even within the core U.S. market, Starbucks has room to expand with lunch sales, online ordering and delivery, and a deeper penetration of drive-thru locations.

A woman having her hair washed.

Image source: Getty Images.

Ulta Beauty has a narrower focus. CEO Mary Dillon and her team plan to add 100 stores, or about 10% more selling space, to its physical footprint while continuing to invest in the highly successful online sales channel. Over the longer term, the retailer sees annual comps gains slowing but remaining strong at 8% through 2019.

Inventors who don't mind the risk associated with a potential industry slowdown will find Ulta Beauty an attractive buy, especially now that the stock has pulled back from all-time highs. In my view, though, Starbucks' pricing power and wide reach across retailing segments and geographies will translate into a better long-term investment, despite the lower growth pace today.

Demitrios Kalogeropoulos owns shares of Starbucks. The Motley Fool owns shares of and recommends Starbucks and Ulta Beauty, Inc.. The Motley Fool has a disclosure policy.