Baidu (BIDU 1.02%) and Alibaba (BABA 2.59%) are two of the most prominent tech companies in China. Baidu owns the country's largest search engine, the world's second largest smart speaker business, an expanding AI business, and a growing platform for driverless cars. Alibaba dominates China's e-commerce and cloud markets, and it's gradually expanding both businesses overseas.

Over the past 12 months, Baidu's stock plunged more than 50% as Alibaba's stayed nearly flat. Baidu fell out of favor because its core advertising business was slammed by the trade war, economic slowdown in China, and competition from rival platforms.

An illustration of a bear battling a bull.

Image source: Getty Images.

Meanwhile, Alibaba's growth remained robust as Chinese consumers continued buying products online and enterprise customers kept signing up for its cloud services. Based on those facts, Alibaba seems like a safer investment than Baidu -- but will those trends continue over the next few quarters?

The differences between Baidu and Alibaba

Baidu generated 73% of its revenue from online ads last quarter. The rest of its revenue mainly comes from its video streaming platform iQiyi (IQ 6.26%), cloud services, and smart speakers and screens. Baidu spun off iQiyi in an IPO last year, but it retains a majority stake in the company and covers some of its content costs.

The growth of Baidu's online ad business ground to a halt in the first half of 2019, but iQiyi's growth kept its total revenue growth in positive territory. However, Baidu's growing dependence on iQiyi is a double-edged sword, since iQiyi's unprofitable and capital-intensive business weighs down its earnings.

Alibaba's core commerce business generated 87% of its revenue last quarter. The unit houses Taobao (a consumer-to-consumer platform), Tmall (a business-to-consumer platform), Alibaba.com (a business-to-business platform), and AliExpress (for overseas shoppers), as well as brick-and-mortar stores and a majority stake in Southeast Asian e-commerce giant Lazada.

The rest of Alibaba's revenue comes from its cloud, digital entertainment, and innovation initiatives units. None of those businesses are profitable, so Alibaba leverages the growth of its profitable core commerce business to expand those smaller units, which widens its moat against Baidu, Tencent (TCEHY 3.56%), and other rivals.

Which company is growing faster?

Baidu's biggest problem is its advertising business. Its ad revenue fell 9% annually last quarter, due to lower ad spending from companies and competition from rivals like ByteDance and Tencent's WeChat.

That decline was offset by the 44% growth of Baidu's "other" businesses (mainly iQiyi, Baidu Cloud, and smart speakers), but its total revenue rose just 1% annually. Baidu's weak ad growth and its growing dependence on lower-margin businesses caused its adjusted operating margin to plummet 18 percentage points annually to 7% during the quarter as its adjusted net income plummeted 53%.

A smart speaker on a table with a couple in the background.

Image source: Getty Images.

Alibaba's business, however, was firing on all cylinders last quarter. Its core commerce revenue rose 44% annually, fueled by robust demand for fast-moving consumer goods, apparel, consumer electronics, and home furnishings, which indicated that China's economic slowdown wasn't hurting the average shopper.

Its other businesses were also healthy -- its cloud revenue surged 66%, its digital media revenue grew 6%, and its innovation initiatives revenue rose 21%. None of those businesses generated a profit, but the strong growth of Alibaba's core commerce business offset their losses. As a result, Alibaba's total revenue rose 42% annually, its operating margin expanded from 10% to 21%, and its adjusted net income jumped 54%.

The outlook and valuations

Baidu expects its revenue to fall 1% annually during the third quarter. It didn't provide any bottom line guidance, but analysts expect a 53% decline. They also expect its revenue and earnings to decline 1% and 54%, respectively, for the full year.

Alibaba didn't provide any guidance, but Wall Street expects its revenue and earnings to rise 32% and 23%, respectively, for the full year. Those forecasts indicate that Alibaba is much better insulated from macro headwinds and competition than Baidu.

Baidu trades at 17 times forward earnings, which is slightly lower than Alibaba's forward P/E ratio of 20. However, Baidu deserves a lower multiple due to its negative earnings growth, while Alibaba deserves a higher one since it's still clearly a growth stock.

Based on those facts, Alibaba is clearly a better buy than Baidu. I own shares of Baidu, and I think it will eventually rebound as its newer initiatives (like mini programs, voice search, AI, and connected cars) kick in, but it will likely remain in the penalty box until its core advertising business improves.