Despite Apple, Microsoft, and Tesla delivering some of the best gains in stock market history since they each came public, they aren't the best performing names in the S&P 500 index over the last 10 years. In fact, none of them even crack the top 10.

However, the time frame does play a very important role when making these comparisons. For example, Apple is the best-performing S&P 500 stock over the last 20 years, and as analyst Charlie Bilello points out, the group of stocks leading the market does change quite dramatically depending on the time scale:

As you can see, the last 10 years have been dominated by semiconductor stocks like Nvidia (NVDA 6.18%), Advanced Micro Devices (AMD 2.37%), and Broadcom (AVGO 3.84%), which occupy the top three spots. Here's why.

The third-best performing stock over the last 10 years: Broadcom

AVGO Total Return Level Chart

AVGO Total Return Level data by YCharts

Broadcom was originally founded in 1991, and it's responsible for a number of computing and electronics innovations like the optical mouse sensor as well as infrared transceivers, which facilitated wireless data exchange between printers, phones, cash registers, and more. But the company was transformed in 2016 when it merged with semiconductor giant Avago Technologies, and it's now a conglomerate with a presence in several segments of the tech industry.

Beyond the merger with Avago, Broadcom acquired semiconductor device supplier CA Technologies for $18.9 billion in 2018, cybersecurity giant Symantec for $10.7 billion in 2019, and cloud computing software powerhouse VMware for a whopping $69 billion in 2023.

VMware is perhaps Broadcom's most significant deal ever, and not just because of the gigantic price tag. The company develops cloud software to help enterprises maximize their computing infrastructure, which is critical right now because technologies like artificial intelligence (AI) require substantial amounts of computing power.

For example, one user with one server might only utilize 10% of its capacity, but VMware's virtual machines allow multiple users to plug into that same infrastructure to harness as much of it as possible, minimizing waste. It adds another pillar to Broadcom's growing portfolio of AI-adjacent products and services.

Broadcom delivered a record $35.8 billion in revenue during 2023 (ended Dec. 31). VMware's revenue will be lumped together with the rest of the conglomerate starting in 2024, and that will help increase the company's revenue base by an impressive 40% this year, taking it to $50 billion (according to management's guidance).

Broadcom might just hold onto its position as one of the best-performing stocks.

The second-best performing stock over the last 10 years: Advanced Micro Devices

AMD Total Return Level Chart

AMD Total Return Level data by YCharts

Advanced Micro Devices designs some of the most popular central processing unit (CPU) and graphics processing unit (GPU) chips for personal computing and gaming purposes. AMD's hardware powers both of the world's most successful gaming consoles, the Sony PlayStation 5 and the Microsoft Xbox Series X. AMD chips can also be found in the infotainment systems in Tesla's electric vehicles.

But the more recent gains in AMD stock have been driven by its data center business, which is home to the new MI300 series of chips designed to handle AI workloads. The MI300 comes as a pure GPU (MI300X), but also in a CPU-plus-GPU configuration (MI300A) to create the world's first accelerated processing unit (APU) for data centers. The MI300 series is AMD's answer to Nvidia's industry-leading H100 AI chip and the upcoming H200.

Data center operators Microsoft, Oracle, and Meta Platforms have become MI300 customers already. Tesla CEO Elon Musk says his company might also be using the chips soon. In an earnings call with investors for the recent fourth quarter of 2023, AMD dramatically increased its forecast for data center GPU sales thanks to the MI300's growing customer pool. The company originally estimated sales would reach $2 billion during 2024, but that forecast now stands at $3.5 billion.

But it gets better. During the quarter, AMD revealed it had an estimated 90% share in the market for AI chips for personal computers. Millions of computers have shipped with the new Ryzen 7000 series (also known as Ryzen AI) CPUs. They allow AI workloads to be processed on-device, making the user experience much faster because they don't have to outsource computing power to external data centers.

Ryzen AI chips drove a whopping 62% year-over-year increase in AMD's client segment revenue during Q4, and the company is preparing to release next-generation variants that could be 3 times faster than their predecessors.

The combination of AMD's growing presence in the AI data center space and its dominant position in personal computing could make 2024 its best year ever, which should drive even further gains in its stock price.

The best performing stock over the last 10 years: Nvidia

NVDA Total Return Level Chart

NVDA Total Return Level data by YCharts

The title of best-performing stock of the last 10 years goes to Nvidia. It delivered a seismic gain of 17,900%, which means an investment of just $1,000 a decade ago would be worth $179,000 today. As I mentioned earlier, the company's H100 GPU is the world's leading AI data center chip, and demand is so hot that Nvidia simply can't produce them fast enough.

Nonetheless, in the recent fiscal 2024 third quarter (ended Oct. 29), the company's data center revenue still more than tripled to a record-high $14.5 billion. Management expects to deliver another record-breaking quarter when it reports its fiscal 2024 fourth-quarter results later this month, for the three months ended Jan. 31.

Investors' focus is now on Nvidia's new H200 chip, which is due for release midyear. When it comes to inferencing -- feeding live data to an AI model so it can make real predictions -- the H200 delivers up to twice the performance of its predecessor. It also consumes half the amount of energy, making it far cheaper for data center operators to run.

If Nvidia's forecast for the fiscal 2024 full year proves accurate, its $58.8 billion in revenue would represent an incredible 1,323% growth over the last decade. Therefore, the substantial gain in its stock price is certainly backed up by its financial results.

The law of large numbers will prevent Nvidia from maintaining such astronomical growth rates forever, but Wall Street analysts still expect the company's revenue and earnings per share to grow by 58% and 69%, respectively, in the upcoming fiscal 2025 full year (which will run from Feb. 1, 2024 until Jan. 31, 2025).

Plus, depending which Wall Street forecast you rely upon, AI could add anywhere from $7 trillion to $200 trillion to the global economy over the next decade. Nvidia might be facing increased competition from the likes of AMD, but its data center chips are still the gold standard for now, so more upside could be on the way for its stock price in the coming years.