There are plenty of shareholders who claim to be long-term buy-and-hold investors, but significant volatility, economic uncertainty, and a skyrocketing valuation can test the mettle of even the most seasoned investor.

Such has been the case with Palantir Technologies (PLTR 1.04%) over the past half-decade. After soaring more than 300% in the four months following its highly touted direct listing in late September 2020, the stock reversed course, losing as much as 84% of its value in the two years that followed. However, those who held through the volatility have profited handsomely.

Person in business attire smirking and scattering $100 bills.

Image source: Getty Images.

Five years ago, Palantir primarily supplied data mining and artificial intelligence (AI) solutions to law enforcement, defense, and intelligence agencies within the U.S. government. Its growth was respectable, as full-year 2020 revenue of $1.1 billion climbed 47%. However, Palantir's losses continued to mount, climbing to $1.16 billion that year, outpacing its revenue.

Fast-forward to today, and Palantir is a very different company, as its commercial business accounts for the lion's share of its accelerating revenue growth. For the second quarter, revenue of $1 billion climbed 48% year over year, while its adjusted earnings per share of $0.16 surged 78%.

U.S. commercial revenue, led by its Artificial Intelligence Platform, jumped 93% year over year, and now accounts for 31% of total revenue. At the same time, Palantir's remaining performance obligation surged 77% to $2.42 billion.

Palantir investors have learned firsthand the value of patience. In fact, if you'd invested $1,000 in Palantir stock five years ago, you'd have $18,320 today (as of this writing). To be fair, no one could have predicted the blistering demand for AI that continues to drive the stock higher. That said, it shows the importance of maintaining a long-term outlook and the potential for profits that could lie ahead.