After booming through much of the pandemic, the tide has turned on big tech this year. 

Layoffs have become common. Companies overinvested during the heady growth days of 2020 and 2021, and, with a recession possibly around the corner, growth rates have fallen significantly. Among the losers are Alphabet (GOOG 0.03%) (GOOGL -0.03%) and Amazon (AMZN 0.36%). Both stocks have fallen sharply this year, down 33% and 47% year-to-date.

Both these companies are still among the biggest in the world, however, and dominate their respective industries, making the sell-off a potential buying opportunity. Which is the best one to buy while they're down? Let's take a look at what each one has to offer today.

A search giant looking sluggish

While Alphabet gets attention for its cloud business and other bets, the company is an advertising platform at its core, and that is the source of nearly all of its profits.

As interest rates rose and fears of a recession swept through the market, businesses pulled back on ad spending in order to conserve their budgets and prepare for lower consumer spending.

Alphabet reported just 6% revenue growth in its most recent quarter, or 11% growth in constant currency terms. The Google parent's profits also fell as it continued to ramp up hiring, with operating income declining 19% to $17.1 billion.

The good news is that management said it would start to scale back on hiring in the fourth quarter and into 2023 in order to shore up its profit margins.

Investors should also keep in mind that the advertising business is cyclical and that demand for ads on Google search and YouTube will recover as the economy rebounds. Alphabet similarly saw revenue growth dip in the great recession and more recently during the pandemic, and both times it recovered rapidly.

The e-commerce king enters a new phase

Like Alphabet, Amazon has faced a number of challenges this year, but the e-commerce leader hasn't been shy about trimming the fat after years of adding too much bloat.

In November, Amazon said it would lay off 10,000 employees as the company looks to cut costs and adapt to slower growth in its business. Amazon guided to revenue growth of just 2% to 8% in the fourth quarter.

The layoffs appear to be focused on the Alexa and devices division -- Alexa is reportedly losing $10 billion a year, according to Business Insider.

The company also pulled the plug on experiments like Amazon Care, its in-person and telehealth business; Fabric.com, which sells sewing supplies; and Scout, its home delivery robot. Additionally, it's canceled or closed dozens of warehouses, as the company overexpanded capacity during the pandemic when sales were soaring.

Those layoffs and cost-cutting measures come after Amazon lost billions of dollars this year outside of Amazon Web Services. Through the first three quarters it lost $8 billion in its international and North America segments, which are made up of mostly its e-commerce business, though they also include money-losing ventures like Alexa, making the operating performance difficult to parse.

Beyond the temporary challenges, Amazon's revenue is also getting to the point where it's difficult for the company to maintain its historically high growth rate. As the company's revenue crosses $500 billion this year, growing the top line by 20% will mean adding $100 billion in revenue -- which is a tall task for any company, even Amazon. 

Which is the better buy?

Alphabet and Amazon still look well-positioned to outperform over the long term, even if both companies are likely to feel the impact of any recession next year.

However, Alphabet looks better prepared to bounce back as the economy recovers. Just as advertising is one of the first expenses to get cut in tough times, it tends to ramp up quickly when the return on investment justifies it. And there's little doubt that Google will remain the leading digital ad platform as it dominates internet search.

Alphabet is also much cheaper than Amazon, trading at a price-to-earnings ratio of 19, and its hiring slowdown means that margins are likely to ramp up once business recovers.

Amazon, on the other hand, seems to have more work to do to improve its margins, as the company is losing money in a number of different areas. It's unclear when its e-commerce segments will return to profitability, and the company even warned about growth slowing at AWS, though the cloud infrastructure business remains a juggernaut.

Amazon is also significantly more expensive than Alphabet, making it the riskier stock to own.

Of these two FAANG stocks, Alphabet looks like the better buy before 2023 starts. The company has a clear path to recovery, and the stock looks underpriced. Amazon, on the other hand, looks like it will face more challenges in rebuilding its profits, and the stock is more expensive. 

While both of these stocks are worth owning, Alphabet is the more reliable one to outperform over the next year.