We all know that good things take time in investing. However, there remains a sizable difference between understanding this motto and actually living it.

Case in point, longtime winner Baidu (NASDAQ:BIDU) has badly lagged benchmarks like the Nasdaq Composite over the past five years.

BIDU Chart

BIDU data by YCharts

To be sure, frustrating periods of extended underperformance will test even the most steely long-term investors. However, examining the things that have changed and those that have remained the same at Baidu over this period both show that the Chinese search giant remains of compelling stock to own today.

What's eating Baidu stock?

Digging into the nuts and bolts of Baidu's struggles reveals a company very much in transition. This should come as no surprise to longtime followers of the company, which has evolved from a pure-play search provider into an increasingly diverse online platform.

Accomplishing this has required Baidu to invest heavily across its entire business, which has eaten into the company's gross margins and profit margins in recent years. Apologies in advance for throwing a lot of data your way, but the following chart nicely captures how Baidu's financial performance has shifted in recent years.

BIDU Revenue (Quarterly) Chart

BIDU Revenue (Quarterly) data by YCharts

The general trend might appear alarming at first; it admittedly does not look pretty. However, putting each component of Baidu's cost of goods (COGS) and operating costs under a microscope presents a far less troubling reality.

As a general trend, each of Baidu's many COGS and operating expense subcategories has increased 1% to 2% as a percentage of revenue in recent years -- with one notable exception. Baidu's content costs have exploded of late, rising from 3.8% of revenues in 2014 to 11.1% of sales last year. Its content licensing fees alone eclipsed $1 billion for the first time last year. However, as we have seen with streaming titan Netflix, building a profitable streaming operation involves meaningful losses up front, but can provide impressive profit margins upon reaching scale.

Let's quickly run down some of the other key factors impacting Baidu. Its recent revenue decline was a direct result of changes in Chinese regulations on the quality control of online ads.  After a series of false online ads triggered high-profile news stories, regulators in Beijing clamped down on false or misleading practices in the way Baidu displayed advertisements in search results. In the short term, this cost Baidu some paid advertising sales, which cut into revenues. However, the changes the company made in response to the regulators should strengthen the credibility of its core product over time, which bodes well for Baidu over the long term.

An image of concept of a self-driving car, an area where Baidu has invested heavily in recent years.

Image Source: Getty Images

Baidu: Buying a better tomorrow

All of its spending might seem rather disconcerting if it weren't for one thing: Baidu is dramatically solidifying its long-term competitive footing by investing heavily in the here and now. It's a similar strategy to that of Alphabet, and one that should eventually yield impressive returns for Baidu shareholders.

For example, consider the emerging suite of businesses Baidu collectively refers to as Transaction Services,  formerly Online-to-Offline (O2O). Several years ago, the major Chinese internet players began expanding beyond their original niches into an all-out land grab to create online services of all types. For Baidu, this meant scaling up services such as takeout delivery, online ticket sales, and restaurant and hotel reservation booking, to cater to China's hundreds of millions of increasingly internet-savvy consumers. And though it remains early days for Transaction Services -- the segment reduced Baidu's non-GAAP operating margin by 16.8% in its most recent quarter -- Baidu's management sees its various online platforms as representing a total potential $400 billion opportunity over the long-term.

Beyond wading deeper into proven online business models, Baidu has  moved aggressively to become a force in futuristic next-gen technologies like artificial intelligence and autonomous vehicles The company has set an ambitious goal of deploying its self-driving prototypes on Chinese streets as soon as next year, albeit probably in semi-contained areas like airport traffic loops and the like.

Baidu recently experienced something of a setback in its efforts to play a leadership role in these areas with the resignation of its head of  research, Dr. Andrew Ng , who is widely regarded as a world-class visionary in AI. However, Ng helped facilitate a dramatic influx of AI research talent during his tenure, and the company is still generally seen as an emerging power in this nascent field.

These growth catalysts should start to positively impact Baidu's results sooner than many investors might expect. Case in point: Consensus Wall Street estimates forecast Baidu's EPS to grow by 8% this year before re-accelerating to a 40% year-over-year increase in 2018.  So while the company might appear expensive at first glance, trading at 42 times  its trailing 12-months earnings, based on the expected surge in 2018, its valuation of 24 times  forward earnings seems more reasonable.

Especially since China's internet market as a whole remains very much in its early days, Baidu stock certainly seems like compelling growth opportunity for long-term tech investors today.

Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. Andrew Tonner owns shares of Baidu. The Motley Fool owns shares of and recommends Alphabet (A shares), Alphabet (C shares), Baidu, and Netflix. The Motley Fool has a disclosure policy.