History is proof that buying a diverse portfolio of stocks is a great idea, because over the long term, the broader market tends to go up. But 2022 was one of the rare years the overall markets suffered a loss, with the Nasdaq-100 technology index leading the way by plunging 33%. 

It's off to a better start in 2023 with a 17% gain so far, but the current environment is incredibly tricky to navigate. It's often referred to as a stock picker's market, which means only certain companies in specific industries are doing well. That's because economic factors like high inflation and rising interest rates are affecting companies in different ways.

Here's an example. Semiconductor service company Axcelis Technologies (ACLS 1.48%) has soared by 70% year to date, obliterating the return of the Nasdaq-100, while action camera company GoPro (GPRO -1.12%) is down 1%. 

Despite the difference in performance, here's why both stocks are a buy over the long term. 

1. Axcelis Technologies is carrying a record order backlog

The semiconductor sector overall is off to a strong start this year, with the iShares Semiconductor ETF climbing 23.6%. But the monster gain in Axcelis stock so far aligns it with some of the industry's biggest names including Advanced Micro Devices (up 70%) and Nvidia (up 88%). 

Axcelis was also one of very few stocks that finished 2022 in the green despite the plunging Nasdaq-100. So why the consistent outperformance? The company produces ion implantation equipment, which is critical to the chip fabrication process, and as many chip manufacturers are expanding capacity in preparation for long-term growth in demand, that equipment is a key part of their plans. 

Axcelis generated $920 million in revenue in 2022, which blew away its initial guidance of $850 million and represented 39% growth compared to 2021. But the real story was the company's order backlog which ballooned to $1.1 billion, signaling 2023 could be another strong year as that pipeline converts into revenue. 

Profitability was another bright spot last year, as Axcelis' earnings per share almost doubled to $5.46. That's a major reason its stock price is performing so well. Despite the company's impressive operational success, its stock trades at a price-to-earnings (P/E) ratio of 24.3, which is still cheaper than the 25.3 P/E of the Nasdaq-100 index.

Therefore, even though Axcelis stock has jumped 70% to start 2023, there's a clear case for buying it now anyway. 

2. GoPro is suffering from weak consumer spending

It's not easy to be a consumer products company right now, especially one that makes expensive electronics. In an economy with high inflation, such items are usually slashed from household budgets first because people are more focused on servicing debts and their rising grocery bills. 

That's why GoPro stock has struggled to get off the ground in 2023 despite posting solid results last year -- though it's prudent to point out the stock has declined by 94% from its all-time high, which was set back in 2014. The company is in the middle of a major transformation from a one-dimensional producer of action cameras to a powerhouse with multiple revenue streams across both hardware and software.

It made further progress toward that goal in 2022. At the end of the year, it had 2.25 million customers paying a $49.99 annual subscription fee to its GoPro.com website, which grants them access to unlimited cloud storage, live streaming capabilities, and exclusive product discounts. That subscriber figure grew 43% year over year, and the company says this revenue stream will be worth upwards of $100 million in 2023. 

GoPro also has 279,000 subscribers paying $9.99 annually for its Quik mobile app, which is designed as a better alternative to native smartphone cameras. Plus, this year, the company is slated to release new desktop-based video editing software which will add yet another revenue stream.

It will take time for the subscription-based products to become a notable share of GoPro's $1.1 billion in total annual revenue, but they carry a gross margin as high as 80%, which means much of the revenue they do generate will flow through to the bottom line as net profit. 

Speaking of which, GoPro generated $0.47 in non-GAAP earnings per share in 2022, so its stock trades at a P/E ratio of just 10.6 right now. That's a 58% discount to the 25.3 P/E of the Nasdaq-100 index, and while GoPro will need to prove it can grow its overall revenue and profit consistently in order to close that gap, it does present a very attractive risk-reward proposition despite its sluggish start to the year.