Image source: Facebook.

In Mark Zuckerberg's perfect world, Facebook (META 0.93%) would have never bought Instagram. It would never have paid close to $22 billion in cash and stock for WhatsApp. That $2 billion he spent to acquire Oculus would still be padding Facebook's pile of cash.

Despite the huge success of the Instagram acquisition, investors should keep in mind that big acquisitions often fail. The more a company spends on a failed acquisition, the bigger the impact on its balance sheet with worthless goodwill, creating the potential for massive writedowns impacting earnings results.

If a company can avoid making these big, multibillion-dollar acquisitions, it should, according to Mark Zuckerberg. "As CEO, it's your job to not get in a position where you need to be doing these crazy things," the Facebook CEO told CNN in a recent interview.

Zuckerberg has failed on that goal on several occasions, but the fact that he maintains that stance should be encouraging for investors. It suggests a certain discipline in how he handles Facebook's spending.

DIY

Talking specifically about Facebook's Oculus acquisition, Zuckerberg said, "If we'd done a better job of building up some of the expertise to do some of that stuff internally, then maybe we wouldn't have to do that."

Apple (AAPL 0.19%) takes a similar approach, as it very rarely buys companies with products that compete directly against its own. (The only exceptions are NeXT and Beats.) Instead, it buys companies that produce products or services that it can integrate into its own. Almost every product Apple sells is the result of its own research and development efforts (OS X and Apple Music being the exceptions).

Facebook has been ramping up its R&D spending. From 2013 to 2015, R&D spending grew more than threefold. It accounted for 27% of revenue last year versus 18% in 2013. A large part of that increase is from the stock-based compensation it amortizes for the acquisitions of WhatsApp and Oculus. It's hard to separate out what amount of share-based compensation is for acquisitions and what is compensation for employees, but adjusted R&D spending still increased about threefold during the previous two years.

Even with the huge increase in R&D spending, however, Facebook's revenue growth has been able to keep pace. Revenue accelerated through the first half of 2016, growing 56% year over year, while R&D expenses only grew 33%. That's important considering 2016 is the first year with a relatively fair year-over-year comparison, since Facebook didn't make any new mega-acquisitions last year.

Apple, by comparison, has seen its R&D spending as a percentage of revenue ramp up over time as it looks for its next big product. From 2011 to 2015, R&D as a percentage of revenue grew from 2.2% to 3.5%. Total expenses more than tripled in that time. Of course, 3.5% is still minuscule compared to Facebook's 27% last year, or any other tech company, for that matter.

Will Zuckerberg fail again?

Facebook will almost certainly make another big acquisition at some point in the future. There are millions of companies and individuals working on new ad tech, apps, and software that will compete with Facebook. Facebook is also working to solve problems like connecting people in rural areas of developing countries to the internet or improving the virtual reality experience, which requires tons of hardware expertise.

"You can't be ahead of everything," Zuckerberg said in his recent interview with CNN. He added, "It's better to make big moves and be willing to do that than to have pride ... and never admit that you could've done something better in the past."

Apple showed humility when it purchased Beats for $3 billion. The iPhone maker is the leader in digital music downloads, but long eschewed music streaming. Even as music streaming grew in popularity, Apple remained largely on the sidelines until it decided to buy Beats and develop Apple Music with its technology.

In an industry with a much lower barrier to entry, Facebook is likely going to have to snatch up some more companies with big valuations. Mark Zuckerberg's discipline to only buy what Facebook needs and leave what it can do without will serve Facebook investors well, but it requires faith in his vision for the future.