Given that FireEye (MNDT) stock is up a whopping 30% year to date while peer Palo Alto Network (PANW -0.38%) has inched up a mere 8%, it would be easy to assume the former knocked its first-quarter earnings out of the park, while the latter struggled.

Thing is, FireEye's Q1 included a mere 3% increase  in sales to $173.7 million, while Palo Alto pleasantly surprised investors and pundits   with an impressive 25% jump in revenue to $431.8 million, well above guidance and Wall Street's estimates. So which is the better buy now? Despite the performance discrepancy this year, the answer to which stock looks like the best long-term holding is far from cut-and-dried.

Futuristic picture of a key inside a digital orb.

Image source: Getty Images.

The case for Palo Alto Networks

Investors have long overlooked Palo Alto's bottom-line losses thanks to its soaring revenues, which rose quarterly by more than 50% year over year for a string seven quarters. Those days are over, though, and growth has been slowing for more than a year, which is why Palo Alto's revenue guidance for last  quarter of "just" 17% to 20% hit its stock hard. Until Palo Alto reported its 25% sales gain due to "[e]xpansion within our existing customer base and new customer acquisitions."

Though its top  line remains impressive, it's become harder to overlook Palo Alto's mounting expenses as its revenue growth rate slows. The upside is that CEO Mark McLaughlin has finally taken steps to better manage overhead, particularly sales and marketing costs. While there is still a long way to go, Palo Alto made some progress in its fiscal third quarter.

The company shelled  out $226.9 million to fund its sales efforts, a 16%  year-over-year increase. However, in the previous quarter, Palo Alto spent virtually the same amount in sale costs -- $226.7 million -- which was a 25% increase from Q2 2016. Expenses will be a key metric to monitor whenit shares fiscal Q4 results next month.

McLaughlin's efforts to grow Palo Alto's recurring revenue via software subscription sales should also help put a lid on spending because it costs less to service existing clients than to rely on new sales. It reported $267.6 million in subscription and support revenue last quarter, a 46% jump and equal to 62% of total sales. If Palo Alto continues making headway in these critical areas, a strong case can be made for its stock as the better buy.

The case for FireEye

Answering the question of why FireEye stock is up 30% this year despite its anemic revenue growth is simple: The results of CEO Kevin Mandia's cost-cutting initiative and the shift to cloud-based software subscription sales have been nothing short of stellar. Mandia's first order of business when he moved up to the CEO position last year was paring down FireEye's workforce, particularly within its sales and marketing division.

FireEye still spent more on operating expenses than it generated  in revenue last quarter, but the $180.85 million was a 29% drop compared to last year's eye-popping $252.94 million, especially when you consider it only reported $167.98 million in sales in 2016. Sales costs nosedived 23% to $94.88 million, which is still more than half of sales -- a trait FireEye shares with Palo Alto -- but a clear sign its expense management is taking hold.

FireEye's own recurring revenue push is also making headway. A full 86% of its $173.74 million in Q1 revenue was derived from subscription and service sales. Just as impressively, the $150 million in ongoing revenue was a 12% year-over-year increase, more than making up for the nearly $10 million drop in product revenue to $23.74 million.

There are a lot of similarities between Palo Alto and FireEye as they continue their respective transitions. That said, FireEye is further along in its transformation, as it demonstrated last quarter. That's why -- in the near-term, at least -- its gets the nod as the better stock to buy.