As the world becomes more technological, demand for semiconductors and memory -- the building blocks of all our ultracool gadgets -- is likely to soar. One way to play this trend is semiconductor equipment stocks, which sell the "picks and shovels" to chip manufacturers worldwide.

Like the semiconductor and memory industries, the semiconductor equipment industry has consolidated, to a handful of key global players. Two of the largest are U.S. companies Lam Research (NASDAQ:LRCX) and Applied Materials (NASDAQ:AMAT).

So which of these two companies is the better buy today?

Let's start with a look at what they do. While Lam and Applied Materials don't sell the exact same products, there's a large product overlap between the two in the deposition and etching equipment markets. Deposition is when a machine "deposits" a material on a silicon wafer -- whether copper, tungsten, or another substance. Etching machines then remove portions of the material from the wafer, leaving the deposit in the shape of the chip design. The process is repeated over and over again across a variety of materials and shapes until a complex circuit is completed.

A bar on top of a tube. Balanced on the bar are two spheres, one at each end.

Image source: Getty Images.

End market diversification

For equipment makers, having a diversified base of customers can be an advantage. The less the dependence upon a single industry or customer, the better the ability to weather downturns in any one business. Here's how end market exposure shakes out for Lam and Applied.

Market Lam Research (% of system shipments) Applied Materials (% of net sales)

NVM

57% 37%
DRAM 27% 31%
Foundry 10% 21%
Logic and other 6% 11%

Data sources: Lam Research and Applied Materials company filings.

As you can see, Applied Materials' end markets are more evenly dispersed among non-volatile memory (NVM), dynamic random access memory (DRAM), semiconductor foundry, and logic manufacturers, while Lam is mostly exposed to NVM and DRAM memory markets. While it's likely that an economic downturn could take down all four of these categories, Applied Materials' customers are more evenly dispersed, so it has a slight advantage here.

In addition, Applied Materials only had two customers that accounted for more than 10% of its sales in 2017. In contrast, Lam Research had four 10% or more  customers, so Applied Materials is more diversified by individual customers as well.

Winner: Applied Materials.

Growth

Lam and Applied Materials have both been posting pretty stellar numbers during this current semiconductor boom. As you can see, Lam has posted slightly better growth during the recent period. That could be due to both its smaller size and its high exposure to memory products, which have recently been booming even more than the semiconductor industry as a whole.

AMAT Market Cap Chart

AMAT Market Cap data by YCharts.

While a shift away from memory could flip the scales, right now Lam both has better growth and is smaller, leaving a larger potential runway.

Winner: Lam Research.

Margins and R&D spending

While revenue growth is prized among investors, profitability also matters. For instance, if a company is consistently able to earn outsized profits, it could be a sign that it has competitive advantages over others in the industry.

As it turns out, Applied Materials and Lam Research have very similar operating margins, in the high 20s. Still, Applied Materials seems to have been able to maintain a slightly higher margin fairly consistently over the past couple of years. In the chart below you can see the companies' EBIT margin and R&D to revenue ratio.

AMAT EBIT Margin (TTM) Chart

AMAT EBIT Margin (TTM) data by YCharts. EBIT = earnings before interest and taxes.

Not only has Applied Materials maintained better operating margins, but it's also been spending slightly more on research and development -- both overall (due to its larger size) and as a percentage of revenue -- than Lam. Being more profitable while also investing more today could give Applied an advantage in the future.

Clearly, Applied is slightly more efficient than Lam on several fronts, despite the lower growth.

Winner: Applied Materials.

Valuation

Since both companies have fairly similar profiles, they also have similar valuations, especially their price-to-earnings ratios. Where the two companies part ways a bit is on a comparison of enterprise value to EBITDA, with Applied Materials garnering an 8.36 EV-to-EBITDA ratio compared with Lam Research at 7.02.

AMAT PE Ratio (Forward) Chart

AMAT P/E Ratio (Forward) data by YCharts.

The difference is likely due to Lam's better balance sheet, which has a much higher net cash position than Applied Materials', as you can see in the chart below; negative net debt equals net cash. (Net debt reveals a business's ability to pay off all its debts. It's calculated by subtracting cash from debt, so a negative number is good.)

AMAT Net Total Long Term Debt (Quarterly) Chart

AMAT Net Total Long Term Debt (Quarterly) data by YCharts.

Winner: Lam Research.

Take your pick

With each company winning in two categories, it's really up to individual investors as to how they want to play this space. While Applied Materials seems to be more diversified, larger, and more profitable, Lam Research is growing faster and has a slightly better valuation.

Clearly, the market is paying up for the perceived "safety" of Applied Materials. But if you're looking to get more aggressive, Lam is the stock for you. Truthfully, buying both companies might give you the diversification you need. Both are performing quite well and trade at reasonable valuations.

Billy Duberstein has no position in any of the stocks mentioned. His clients may own shares in some of the companies mentioned. The Motley Fool recommends Lam Research. The Motley Fool has a disclosure policy.