There's nothing more difficult to figure out as an investor than a market that can't decide which direction to move. On Wednesday, market participants seemed more sanguine about the potential impact of the COVID-19 omicron variant on the prospects for future macroeconomic growth, especially in light of testimony from Treasury Secretary Janet Yellen and Fed Chairman Jerome Powell. The Nasdaq Composite (^IXIC -1.31%) was a solid winner, rising about 1.5% by midday Wednesday before pulling back slightly in the early afternoon.

Helping to lift the Nasdaq were a couple of stocks that reached all-time highs on Wednesday. Apple (AAPL -1.13%) continued to defy the law of large numbers by boosting its multitrillion-dollar market capitalization still further on the day, while the much smaller Lam Research (LRCX -1.33%) set a new high-water mark of its own. Below, we'll look more closely at what moved Apple and Lam Research on Wednesday and whether their soaring stocks could have still further to climb in the weeks and months ahead.

Person holding smartphone.

Image source: Getty Images.

Apple looks healthier than ever

Shares of Apple were up almost 3% early Wednesday afternoon, sending the iPhone maker's market capitalization toward $2.8 trillion. Investors continue to be impressed by the way that the company has managed to grow, with ongoing evolutions of popular product lines and newer rollouts that are starting to gain traction.

Apple seems to enjoy a special status among investors. On one hand, the company is fully participating in the digital revolution, with its 5G-capable smartphones leading to a renewed interest in upgrading that has pulled forward considerable revenue entering into the holiday season. A report from China suggesting strong demand for the latest iPhone models gave shareholders a new sense of optimism that Apple can grow even in what has sometimes been a hostile market.

On the other hand, when the stock market does poorly and punishes tech stocks more broadly, Apple nevertheless has held up well. In Tuesday's market rout, for instance, Apple posted gains.

It's apparent, therefore, that many see the tech giant as a relatively defensive play in comparison to smaller companies with less of an ability to weather any potential headwinds coming down the road. That could help Apple do well regardless of the overall market environment.

Chipping away at old records

Elsewhere, Lam Research was higher by more than 3%. That sent the stock price for the semiconductor company above $700 per share and set an all-time record.

Investors have given a lot of attention to semiconductor stocks, but the companies that help chipmakers by providing the necessary equipment for fabrication haven't gotten quite as much exposure. Lam's business involves coming up with wafer fabrication equipment that accommodates the increasingly demanding requirements of its semiconductor company customers.

With chipmakers dealing with semiconductor shortages, there's been a huge effort in the industry to expand quickly. Expansion requires the equipment to make chips effectively, and that's helped to boost Lam's growth as well. Moreover, those favorable trends are seen lasting longer than in past business cycles, and that could give Lam a longer runway for expansion.

When markets get choppy, it's always useful to look at the stocks that are holding up the best. Both Lam and Apple have done well in good times and bad, and that makes them interesting candidates for investors looking for security and growth potential in their stocks.