Ethan Brown, founder and chief executive officer of Beyond Meat, center, celebrates with his wife Tracy Brown, center left, and guests during the company's initial public offering (IPO) at the Nasdaq MarketSite in New York, on Thursday, May 2, 2019.

Based on the terrible public market performance of Uber and Lyft, you might think it's been a bad year for tech IPO investors.

But if you treat every offering equally, IPOs have been a lucrative bet.

Looking at a basket of 13 venture-backed tech IPOs this year, including Slack's direct listing, eight stocks are in the black. If you'd put $1 million into each of them at the IPO price, your $13 million initial investment would be worth $21.7 million — a 67% gain. That calculation follows the debut of cloud security company Cloudflare, which jumped 20% in its first trading day on Friday.

If instead of putting $1 million into every IPO, you'd invested $13 million into the S&P 500 at the beginning of the year, you'd be up 20% at $15.6 million.

All that helps explain why venture capitalist Bill Gurley told CNBC this week that "Silicon Valley has been on the bad end of a bad joke for about four decades now, in terms of the way the traditional IPO process works." Most of the gains come from the immediate IPO pop, meaning companies are giving away upside to new investors.

There are many caveats to comparing this year's IPO investments to the S&P 500. Most notably, this methodology doesn't factor in market cap but just assumes an equal investment in every company. Also, most of the offerings haven't hit their lock-up expiration yet. In the coming months, a flood of new shares will hit the market, potentially pushing some of these stocks downward.

The biggest qualification, however, is that to beat the S&P 500 with these IPOs, you'd need to have Beyond Meat, a food company backed by venture firms, in your tech portfolio. Shares of the plant-based meat alternative company are up 524% since their market debut in March and on a total dollar basis would account for 60% of the gains.

The next best performer is videoconferencing company Zoom, up 120%, followed by security vendor CrowdStrike, up 91%. The biggest laggard is Lyft, down 36%, followed by Uber, which is off 26% and e-commerce company RealReal, down 15%. Slack has plunged 21% in the past seven trading days, leaving the stock 6% below the reference price for its direct listing in June.

Here's a list of 13 venture-backed tech IPOs and how they've performed since hitting the market:

WATCH: Gurley on IPOs