Artificial intelligence (AI) is here, and the stocks leading this nascent industry have electrified portfolios this year. Two prime examples are Palantir Technologies (PLTR 1.38%), up 180% since January, and Nvidia (NVDA 0.03%), up 210%.

That's how the two stocks have done in the recent past, but investing is about looking to the years ahead. Nvidia is now one of the world's largest companies, worth $1.1 trillion. Palantir, worth $40 billion, is building momentum, picking up new business from the government and private sector.

Which is the better investment moving forward? Could Palantir be worth more than Nvidia by 2030? Here is what you need to know.

Palantir is heating up

Palantir is a software company that sells data analytics software that can utilize AI models, identify trends in large data pools, and aid strategic decision-making.

Rising interest rates have pressured spending across the corporate world, which may have slowed Palantir's revenue growth over the past 24 months. However, things are beginning to accelerate again. Revenue growth bottomed midway through the year but rebounded to nearly 17% year-over-year growth in the third quarter. Palantir's customer count as of Q3 is 37% higher year over year and 12% higher quarter over quarter. In other words, Palantir is winning more customers faster, which bodes well for future revenue growth.

PLTR Revenue (Quarterly YoY Growth) Chart

PLTR Revenue (Quarterly YoY Growth) data by YCharts

The company recently won a massive $412 million contract with England's public healthcare system, which should further bolster growth over the next several years. Palantir's financials are also turning the corner; it's now consistently profitable under generally accepted accounting principles (GAAP), and analysts expect that to continue. Earnings could grow at an estimated 72% annually over the long term.

Nvidia's impressive AI lead

Nvidia has an excellent reputation for its high-performance GPU chips. Still, few could have predicted the massive boost artificial intelligence would give its business this year. Revenue growth accelerated to over 200%, a blistering pace that surely won't last but has infused lots of new cash into the business. Free cash flow over the past year is now at $17.5 billion.

Companies have overwhelmingly looked to Nvidia for their AI chips, giving it an estimated 80% market share. It's an early lead, and there's a good chance competition will turn up the pressure, but it's clear Nvidia is on higher ground than the field.

NVDA Revenue (Quarterly YoY Growth) Chart

NVDA Revenue (Quarterly YoY Growth) data by YCharts

Growth from AI raised expectations of the company from analysts, who now estimate a 39% annual earnings growth rate. That's remarkable for a company already as large as Nvidia.

Can Palantir catch Nvidia?

It's important to understand just how large Nvidia has become in such a short amount of time. The company's market cap has added more than $500 billion in value over the past year, more than 10 times what Palantir is worth today.

Palantir's smaller size does help it grow faster, but looking for a more than 20-fold increase from Palantir over the next decade is asking a lot. Earnings could grow by 50% annually for 10 years, and the resulting $8.5 billion in net income at a 30 times P/E ratio would value Palantir at $255 billion, still a fraction of what Nvidia is worth today (not considering Nvidia's future growth).

PLTR Market Cap Chart

PLTR Market Cap data by YCharts

But Palantir remaining smaller than Nvidia isn't a loss for investors. Palantir's expected earnings growth is stellar, and the stock's current forward P/E of 73 creates a PEG ratio of just 1, meaning the stock is a great price for the growth you could get.

No, Palantir probably won't catch Nvidia, but you can buy and hold the stock anyway.