Holding stocks through market volatility is easier said than done, but a long-term mindset is one of the most valuable tools any investor has at their disposal. Tesla (TSLA 0.38%) and Nvidia (NVDA 4.00%) illustrate that point perfectly. Both stocks have had their ups and downs over the past decade, but patient shareholders that stayed the course have been well rewarded.

Since September 2012, Tesla has seen its share price skyrocket more than 13,600%, meaning an initial investment of $5,000 back then would be worth $687,000 today. Meanwhile, Nvidia has seen its share price soar over 3,600%, meaning an initial investment of $5,000 in 2012 would be worth $184,000 now.

Are these two growth stocks still worth buying?

1. Tesla: A shining example of manufacturing efficiency

Without spending a dime on traditional advertising, Tesla has cultivated a premium brand image that continues to fuel strong demand among consumers. In fact, the company once again topped the auto industry in terms of battery electric car sales in the first half of 2022, capturing a 19% market share.

Naturally, that led to strong top-line growth. Revenue jumped 60% to $67.2 billion over the past year. But Tesla achieved something far more impressive: It posted an industry-leading operating margin of 16.2%, which sent free cash flow soaring 165% to $6.9 billion. Several factors have contributed to that success, including a significant cost advantage in battery pack production.

Better yet, investors have good reason to believe Tesla can further improve manufacturing efficiency in the future. As production ramps at Gigafactory Berlin -- its first European manufacturing facility -- logistics costs should fall as fewer cars are shipped to Europe. Tesla is also employing a single-piece casting technique in Berlin and Austin that has reduced the number of welding robots by 70% per unit of capacity. That means the company is spending less time and money on welding because it's casting the front body and rear body of the Model Y as one piece of metal.

Moreover, CEO Elon Musk says full self-driving software will eventually be the primary source of profitability for Tesla, and software companies tend to have much higher margins than automakers. On that note, Tesla has a robo-taxi slated for production in 2024.

Currently, Tesla shares trade at a pricey 13.9 times sales, meaning investors clearly have high expectations. That could make the stock volatile. But Tesla has showcased its capacity for disruptive innovation countless times, so risk-tolerant investors should seriously consider buying a small position in this monster growth stock. If Tesla succeeds in its mission of disrupting the mobility industry with robo-taxis -- a market UBS Evidence Lab says could reach $2 trillion by 2030 -- this $850 billion company could be worth far more a decade down the road, though returns of 13,600% are out of the question.

2. Nvidia: The gold standard in graphics and supercomputer accelerators

Nvidia is best known for its invention of the graphics processing unit (GPU), a semiconductor capable of performing billions or even trillions of calculations per second. Nvidia GPUs have fundamentally reimagined the gaming and entertainment industries with stunning graphics. As a result, Nvidia holds over a 90% market share in workstation graphics, and every film nominated for the Best Visual Effects Oscar in the last 14 years has used Nvidia technology.

However, GPUs have also become essential data center infrastructure because they excel at accelerating complex workloads like data analytics and artificial intelligence (AI). In fact, Nvidia also holds a more-than-90% market share in supercomputer accelerators, and 71% of the top 500 supercomputers in the world are built with the company's technology.

To solidify its position in the data center, Nvidia has added high-speed networking solutions, subscription software, and other developer tools to its portfolio. For example, the Nvidia Drive platform accelerates the development of AI applications for autonomous cars, and Nvidia Isaac helps engineers build and deploy AI applications for autonomous robots. Additionally, Nvidia Omniverse is a simulation engine that allows researchers to train AI models for autonomous cars and robots in a virtual environment.

Nvidia struggled as the macroeconomic environment deteriorated in the second quarter. High inflation dampened consumer demand for its graphics cards, causing a significant drop in gaming revenue. But the company still delivered solid financial results versus the prior year. Revenue climbed 36% to $29.7 billion and earnings rose 9% to $3.05 per diluted share.

Going forward, the future looks bright for this chipmaker. In spite of near-term macroeconomic uncertainty, Nvidia has become the gold standard in graphics and AI, and those technologies will continue to underpin innovation across countless industries. For that reason, management pegs its market opportunity at $1 trillion, and with shares trading at 10.5 times sales -- a bargain compared to the three-year average of 20.3 times sales -- patient investors should consider buying a small position in this growth stock today.