Tech stocks aren't in favor with investors right now, but this weakness makes it an excellent time for investors to go bargain hunting.

I'm planning to buy two tech stocks -- Nvidia (NVDA -3.33%) and Snowflake (SNOW 2.53%) -- that are well off their all-time highs and trading for valuations not seen for a couple of years.

1. Nvidia

Nvidia makes graphics processing units (GPUs) that are used to process intense calculations quickly for uses including gaming graphics, artificial intelligence (AI), and cryptocurrency mining. However, the latter use case has spooked many investors, as cryptocurrency prices have crashed, causing demand to evaporate.

A decline in demand for mining equipment will hurt Nvidia's sales. The company doesn't break out crypto-related sales within its gaming unit, though, so we don't have a clear view of the potential impact. 

Said CFO Colette Kress said during the company's first-quarter conference call with analysts on May 25:

The extent in which cryptocurrency mining contributed to Gaming demand is difficult for us to quantify with any reasonable degree of precision. The reduced pace of increase in Ethereum network hash rate likely reflects lower mining activity on GPUs. We expect a diminishing contribution going forward.

However, in the most recent quarter, the company's data center division overtook the gaming division -- which includes cards meant for gaming and crypto mining -- as the largest revenue generator. The data center segment also grew faster than the gaming segment, with sales up 83% year over year (YOY) versus 31% growth for gaming.

CEO and founder Jensen Huang said during the company's call with analysts that in the fiscal first quarter, which ended May 1, demand in the data center segment "is strong and remains strong." Despite this, management expects total year-over-year revenue growth to slow to roughly 25% for Q2 versus 46% for Q1.

I believe this is a conservative projection, as Nvidia has a habit of beating its own projections. And I'm not overly worried about falling crypto demand. For me, Nvidia remains a top stock due to its impressive data center growth. With AI being utilized more and businesses migrating to the cloud, the use case for Nvidia's products will only increase.

Additionally, Nvidia stock is trading at its lowest level in over two years. While 45 times earnings isn't cheap, with Nvidia's multiyear growth horizon, it's a price I'm willing to pay.

NVDA PE Ratio Chart

NVDA PE Ratio data by YCharts

2. Snowflake

You'd be hard-pressed to find a company that has seen growth as impressive as Snowflake's. The growth rate has been slowing, but I'm still a fan. For its fiscal first quarter, which ended April 30, Snowflake posted an 84% year-over-year jump.

SNOW Revenue (Quarterly YoY Growth) Chart

SNOW Revenue (Quarterly YoY Growth) data by YCharts

The slowdown in growth is to be expected as it's hard to grow as quickly when a business is larger, but the demand for Snowflake's software is still prevalent.

Snowflake makes data storage, processing, and integration easy. With its product suite, clients can store many types of data (even unstructured) and then use Snowflake's data engineering solutions to create models that can feed other applications. Additionally, the company allows customers to store data across multiple cloud providers, providing flexibility.

Snowflake also operates on a pay-as-you-go model, which allows customers to strategically utilize Snowflake instead of writing a huge annual check to pay for a service they may seldom use. This approach has worked well, as customers spent $174 this quarter for every $100 they spent last year.

Snowflake's customer count also rose significantly during the quarter, with the overall count growing 40% to 6,322, and large customers (those who spend over $1 million annually) rising to 206. That's not a ton of customers compared to how many businesses there are worldwide, but that means Snowflake has a massive growth runway in what it estimates to be a $90 billion market opportunity. At only $1.4 billion in trailing-12-month revenue, Snowflake is in the early innings.

The company has some work to do, as it posted an abysmal negative operating margin, but it was free-cash-flow-positive.

With Snowflake stock trading for around 32 times sales, it is far from a cheap stock. However, with the massive market opportunity and strong execution, along with the stock's recent drop, Snowflake is an excellent buy in today's tumultuous market.

Things look good for the long term

Both Nvidia and Snowflake are great buys right now. However, investors will need to be patient as these stocks can rise and fall significantly every day in a tumultuous market. However, if you approach these investments with the mindset of holding for three to five years, I'm confident these stocks will provide market-beating returns.