They say that data is so valuable, it is the new oil. With it, you can offer advertisers the most targeted ads possible. Without it, you are drowning in a sea of competition with absolutely no edge.

This is the true advantage that investors in search engines like Alphabet's (GOOG 1.43%) (GOOGL 1.42%) Google and Baidu (BIDU 2.30%) enjoy. Aside from Facebook, no other companies have collected as much data, and managed to monetize it.

The words "Big Data" surrounded by connections to individual pieces of data.

Image source: Getty Images.

But which is the better buy today? That's an impossible question to answer, especially because geo-politics can play an important role. Baidu operates almost entirely within the borders of China, and is at the behest of the Chinese government. But that alone shouldn't determine which is the better buy.

Instead, we can get an idea for what you are more comfortable with by approaching the question through three key lenses.

Sustainable competitive advantages

Absolutely nothing is more important to the long-term success of an investment than the sustainable competitive advantage of the underlying company you are investing in. Often referred to as a "moat" in investing circles, this represents that special something that separates a company from its competitors.

Alphabet's moat began with Google's unique algorithm that spit out search results faster and more accurately than any other alternative. That algorithm was very popular; it's the reason we "Google" for information, instead of "Altavista" it.

But Google's moat is wider than that: The company has six services in addition to search that have logged over 1 billion users: Google Play, YouTube, Chrome, Android, Gmail, and Maps. Combined, this ecosystem conveys two huge moats. First, Google has more information on user habits than anyone else. This means it can continually offer up products that people are looking for. Other wannabe search engines don't have this data advantage, and can never know for sure where the Next Big Product should be.

Second, Google is slowly building out high switching costs. Because users can sign into a dizzying array of sites today just by being signed into their Google account, the switching costs to another search engine have slowly crept up. Who wants to go back and remember all those passwords if they decide against having a Google account?

Just about everything I just said about Google applies to Baidu. Google has decided that it isn't going to compete actively in China due to government intervention. Although Baidu has had to deal with a few pesky upstarts, that decision has largely left the Middle Kingdom to Baidu.

Baidu has two additional variables worth mentioning. As stated above, the ruling Communist Party in China can exert much more control over Baidu than any other government could on Google, and that's a risk worth considering. At the same time, because the Chinese populace is entering the Age of the Internet much later than Americans, Baidu is trying to capitalize on opportunities Google missed stateside -- namely through creating an Online-to-Offline (O2O) ecosystem, which you can read more about here.

In the end, both companies have very wide moats.

Winner: Tie

Financial fortitude

I wouldn't be the least bit surprised to see both Alphabet and Baidu start paying dividends before I retire (note: I'm 35 years old now). For now, however, investors want to see cash being poured into profitable new growth opportunities.

But as exciting as those growth opportunities may be, the companies must keep a sizable cash stash on hand. That's because every company, at some point, will have to endure difficult financial times. Those that enter such times with cash have options: buy back stock on the cheap, make a strategic acquisition, or -- perhaps most important -- outspend rivals to gain market share.

Debt-heavy companies are in the opposite situation, forced to myopically focus on meeting their debt obligations. Keeping in mind that Alphabet is valued at almost ten times the size of Baidu, here's how the two stack up.

Company

Cash

Debt

Net Income

Free Cash Flow

Alphabet

$86 billion

$4 billion

$19.5 billion

$25.8 billion

Baidu

$20 billion

$5 billion

$1.7 billion

$2.6 billion

Data sources: Yahoo! Finance, SEC filings.

Both of these companies are in very safe positions. Relative to its size, Baidu has much more cash, but also carries much more debt. Net income and free cash flow are about even, and very strong for both companies.

Over a decades-long time horizon, I think both would benefit from a downturn, as it would drive smaller players out of markets where Alphabet and Baidu are working on offering ancillary services or products.

Winner: Tie

Valuation

Finally, we have valuation. While this isn't an exact science, there are some straightforward metrics we can consult to give us an idea of how expensive each stock is.

Company

P/E

P/FCF

P/S

PEG Ratio

Alphabet

25

22

6.3

1.6

Baidu

38

23

5.9

2.3

Data sources: Yahoo! Finance, E*Trade, Nasdaq.com. P/E uses figures from non-GAAP earnings.

Here again we have a very close battle. While Baidu appears to be much more expensive on an earnings basis, the companies are virtually identical in terms of free cash flow -- a metric I give more credence to.

In terms of growth -- measured via the PEG Ratio -- Alphabet trades at a 30% discount to Baidu. That's largely because investments in O2O will be holding down Baidu's earnings for the foreseeable future.

While it's not a huge difference, we need a tiebreaker here, and it will go to Alphabet.

Winner: Alphabet

The winner is...

So there you have it, by the thinnest of margins, Alphabet comes out ahead. It has a more developed business line and more favorable valuation. At the same time, Baidu's O2O aspirations could prove to be an enormous boon to investors -- but it's just too early to know for sure.

As for myself, I have an enormous sum of money tied up in both companies. Combined, they constitute 22% of my real-life holdings. I believe both are worthy of your consideration.