The past five years have been very good to investors in some small-cap technology stocks. Today, we'll be pitting two of the most successful against one another to see which one is more worthy of investment in the future. 

Twilio (NYSE:TWLO) has made a name for itself by helping companies embed the technology necessary to communicate with their customers within their infrastructures automatically. Netflix, for instance, can send subscribers text messages when a new show becomes available using Twilio's technology.

Nutanix (NASDAQ:NTNX), on the other hand, cut its teeth providing "invisible infrastructure." The company's technology helps a special subset of clients: those who want to keep their servers off the cloud platforms of giants like AmazonAlphabet, or Microsoft

Both companies have had stellar runs, and are up an average of 120% over the past year alone. But which is the better buy today?

Young girl in front of a wall painted with arrows towards opposite directions.

Image source: Getty Images

We'll try to answer than question by comparing three different facets of their businesses.

Financial fortitude

When examining any company's financial fortitude -- and especially when it comes to smaller upstarts like Nutanix and Twilio -- there's one big question I like to focus on: If an economic crisis hit right now, would the company go bankrupt, stay about the same, or actually get stronger as a result? You can read more about that here.

Keeping in mind that Nutanix is valued at just over 50% larger than Twilio, here's how the two stack up.

Company Cash Debt Free Cash Flow
Nutanix $924 million $423 million $17 million
Twilio $308 million $0 $6 million

Data source: SEC filings, Yahoo! Finance. Cash includes long and short-term investments. Free cash flow presented on trailing twelve month basis.

Twilio having absolutely no debt is a big deal: It gives the company flexibility in times of stress. However, while the company just became free cash flow positive, which is a great sign, at this point it is just barely in the black.

While Nutanix carries a much heavier debt load, it actually has a larger net cash position. After subtracting debt, the company still has a $501 million war chest. As with Twilio, that's a great position to be in. But as with Twilio, free cash flow isn't at the point yet where it would provide obvious opportunities to strengthen during a downturn, perhaps via buybacks or acquisitions.

As such, I think both of these companies are "robust" in the face of an economic crisis: They'd face short-term headwinds, but over the long run their overall standings would remain about the same.

Winner = Tie

Valuation

Valuing large, well-established businesses can be a tough task, and putting a price tag on small but quickly growing companies is darn near impossible. 

That said, I think it's instructive to take a look at a few traditional metrics to figure out which of these two might be priced at a discount relative to the other.

Company P/S P/FCF PEG Ratio
Nutanix 9.3 560 2.0
Twilio 13.9 1,020 N/A

Data source: Yahoo! Finance, Nasdaq.com. 

Here again I have a tough time separating the two. While Nutanix is demonstrably cheaper on all three metrics, both companies have very high valuations. Nutanix's PEG ratio -- which takes earnings growth into consideration -- is reasonable. But neither one of these companies has a long enough history of earnings or solid free cash flow generation to make reasonable assumptions about how "expensive" or "cheap" their stocks are.

As such, I'm putting this one in the "too-murky-to-determine" pile and calling this a tie. 

Winner = Tie

Sustainable competitive advantages

With both previous match-ups ending in ties, the sustainable competitive advantage becomes all important. Often referred to as a moat in investing circles, nothing is more important for your returns over the long run than a company's sustainable advantages.

Twilio's key advantage comes from high switching costs. Once a company has started embedding Twilio into its communications strategy, switching away from the solution becomes a pain, both logistically and financially.

Bears will scoff at that, pointing out that Uber decided to take some of its business elsewhere in 2017. But there's a difference between the anecdotal and statistical: Last year, Twilio's dollar-based net expansion rate -- which measures how much money all of last year's customers are spending 12 months later -- was 128%. That means customers are not only staying with Twilio, but are using more and more of its solutions as time goes on.

Nutanix, on the other hand, has typically provided hardware solutions for companies. While there's nothing wrong with this on the surface, it's not a business model that lends itself to wide moats. Large purchase orders for servers happen in cycles, and there's little to lock customers into Nutanix over the long run if the competition can come up with better solutions.

Granted, Nutanix isn't worried about that happening right now: Billings expanded by 55% during the company's most recent quarter. But management has made the prudent decision to shift away from hardware and toward software, which helps lock in the same type of high switching-costs that protect Twilio. It has made great strides on this front, but hardware sales still account for 26% of sales over the past nine months.

That might seem like a nit-picking ding against the company, but in such a close battle that's enough for me to give Twilio the advantage here.

Winner = Twilio

And my winner is...

So there you have it: Twilio beats out Nutanix by the narrowest of margins. Neither company is cheap, and while both companies have solid balance sheets they aren't immune to economic downturns.

I don't currently own either stock, but I'm more than willing to give Twilio an out-perform rating on my CAPS profile. If you're looking for a fast-growing software-as-a-service (SaaS) company to invest in, I believe Twilio is worthy of your due diligence.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Suzanne Frey, an executive at Alphabet, is a member of The Motley Fool's board of directors. Teresa Kersten is an employee of LinkedIn and is a member of The Motley Fool's board of directors. LinkedIn is owned by Microsoft. Brian Stoffel owns shares of Alphabet (A shares), Alphabet (C shares), Amazon, and Netflix. The Motley Fool owns shares of and recommends Alphabet (A shares), Alphabet (C shares), Amazon, Netflix, and Twilio. The Motley Fool recommends Nutanix. The Motley Fool has a disclosure policy.