ASML (ASML -0.03%) and Nvidia (NVDA 1.76%) are two of the most important semiconductor companies in the world.

ASML is the world's largest producer of photolithography systems, which are used to etch circuit patterns onto silicon wafers. It's also the world's only producer of high-end extreme ultraviolet (EUV) lithography systems, which are required for the production of the world's smallest chips.

Nvidia is the market leader in discrete graphics processing units (GPUs). GPUs are often associated with processing high-end graphics for video games and digital media applications, but they can also be used to crunch complex AI tasks in data centers and mine cryptocurrencies.

A wafer of chips being manufactured.

Image source: Getty Images.

ASML and Nvidia both hit all-time highs last year as the ongoing chip shortage drove investors toward the sector's top stocks.

But over the past five months, shares of ASML and Nvidia declined about 26% and 35%, respectively, as rising interest rates and other macroeconomic shocks drove investors away from higher-growth tech stocks. Should investors consider buying either of these chip stocks as a turnaround play?

How fast is ASML growing?

ASML's revenue rose 18% in 2020 and grew 33% in 2021 (each representing year over year growth). It expects its revenue to increase 20% to roughly €22.3 billion ($24.4 billion) in 2022.

Its gross margin rose from 48.6% in 2020 to 52.7% in 2021, and it expects that expansion to continue to "around 53%" in 2022. Its gross margins are steadily rising because the world's top foundries -- TSMCSamsung, and Intel -- are willing to pay top dollar for its lithography systems as they race to resolve the ongoing chip shortage. Its ongoing shift toward higher-margin EUV systems has also been boosting its gross margins.

The company's earnings per share (EPS) rose 38% in 2020 and jumped 69% in 2021. Analysts expect its EPS to rise 13% in 2022.

Its near-term margins are being squeezed by supply chain constraints and expedited shipments to its top customers. The prioritization of those shipments has also been disrupting its shipments of older systems. However, it expects most of those headwinds to fade by the second half of 2022.

ASML expects its annual revenue to rise to €24 billion to €30 billion ($32.6 billion) by 2025, based on varying low and high expectations for the chip market. The high end of that forecast implies its annual revenue will grow at a compound annual growth rate (CAGR) of 13% over the next four years.

ASML's stock might seem a bit expensive at 35 times forward earnings, but its wide moat and stable growth rates easily justify that slight premium.

How fast is Nvidia growing?

Nvidia's revenue rose 53% in fiscal 2021 (which ended last January 2021), and grew another 61% in fiscal 2022. But analysts expect its revenue to rise just 29% to $34.8 billion in fiscal 2023.

Nvidia's adjusted gross margins expanded from 62.3% in fiscal 2021 to 64.9% in fiscal 2022, and it expects that expansion to continue with a gross margin of 67% in the first quarter of fiscal 2023.

Nvidia thrived over the past two years as its gaming and data center GPU businesses fired on all cylinders during the pandemic. Consumers spent more time at home and upgraded their PCs for video games and remote work, while the surging usage of cloud-based services and apps forced data centers to process more data with their machine learning and AI algorithms.

But a lot of those tailwinds are now fading away in a post-lockdown market. In addition, cryptocurrency miners are buying fewer gaming GPUs and dedicated mining cards as cryptocurrency prices stagnate.

Nvidia's adjusted EPS rose 73% in fiscal 2021 and climbed another 78% in fiscal 2022. But in fiscal 2023, analysts anticipate just 27% growth as its core growth engines face tougher year-over-year comparisons. They also expect its top- and bottom-line growth to continue decelerating through fiscal 2025.

Unlike ASML, which creates the nuts and bolts of the semiconductor industry, Nvidia faces more specific challenges related to the gaming and data center markets. That's why it's tougher to justify Nvidia's current forward price-to-earnings ratio of 36. It isn't terribly overvalued right now, but its upside potential could be limited in this challenging market.

The winner: ASML

ASML and Nvidia are both solid semiconductor stocks. But if I had to pick one over the other, I'd definitely stick with ASML, for three simple reasons: Its end markets are better diversified, it has more pricing power, and it will likely generate more consistent growth over the next few years.