Shares of Twitter (TWTR) have been on quite the roller-coaster ride over the past few years. The stock hit a high above $50 per share in early 2015, soon after my warning that it was a disaster waiting to happen. It promptly crashed, shedding about 70% of its value in a little over a year.

Over the past year, Twitter stock has staged a major comeback, soaring 135% to around $36 per share. Market sentiment seems to have changed, with founder Jack Dorsey back at the helm, and with daily active users steadily growing. Unlike in 2015, when there was no good reason to buy the stock, there's now at least one reason to consider investing in the social-media company.

TWTR Chart

TWTR data by YCharts.

Twitter is profitable

From 2013 through 2016, Twitter's cumulative net loss totaled $2.2 billion. Until very recently, this company's core competency seemed to be losing money.

That changed in 2017. Twitter still posted a loss for the full year, but it managed its first quarterly GAAP (generally accepted accounting principles) profit in the fourth quarter. The company reported a net income $91.1 million on $731.6 million of revenue, equivalent to $0.12 per share. That's up from a loss of $167.1 million in the prior-year period. Twitter expects 2018 to be its first full year of GAAP profitability.

While Twitter managed to grow revenue by 2% in the fourth quarter, this massive bottom-line swing was due almost entirely to cost-cutting. Total costs were slashed by nearly 28%, driven by a 34% reduction in research and development spending, a 29% reduction in cost of revenue, and an 27% reduction in sales and marketing. Lower stock-based compensation and other employee-related expenses drove those declines.

A hand with scissors cutting a piece of paper that says Costs

Image source: Getty Images.

Cutting costs is something that Twitter has needed to do for a long time. Twitter's first quarterly profit shows investors that the company is now serious about running a sustainable business, not one that spends like a drunken sailor chasing growth. One big question remains: Can Twitter return to more robust revenue growth despite spending a lot less? So far, the answer is no.

Still, investing in a company that has proven itself capable of turning a profit is a lot more palatable than betting on a money-losing enterprise. It made no sense to me to even consider buying shares of Twitter a few years ago. That's no longer the case.

But the valuation is nuts

I won't be buying shares of Twitter anytime soon, though. The company's switch from red to black ink just isn't enough to justify the price of the stock. Twitter is now valued at roughly $27.5 billion -- that's more than 11 times annual revenue.

I'll remind you that this is a company that grew revenue by just 2% last quarter, with revenue slumping in 2017. An upstart company growing revenue by 30% annually deserves a premium valuation. Twitter does not.

The picture gets worse when you look at profits. If Twitter managed to produce the same operating margin during the full year that it did during the fourth quarter, about 15%, it would have produced a full-year operating profit of about $365 million. Back out interest, and we're at about $260 million. Ignoring taxes, that puts Twitter's price-to-earnings ratio over 100. Thanks, but no thanks.

There are other problems with Twitter besides the valuation, including its serious problem with bots. A recent New York Times article put the number of Twitter users that are bots as high as 48 million, or about 15% of total users. The company's platform is at the center of the ongoing investigation into Russian meddling in the 2016 election, and that's a problem that won't be going away anytime soon.

Even ignoring the bot problem, Twitter turning profitable just doesn't justify the stock's price tag. If you buy Twitter stock because the company is no longer losing money, you're paying an awfully high price to do so.