Alphabet, the umbrella for Google’s core business, as well as its riskier "Other Bets," posted its second-quarter earnings today. In the third time the company has detailed its performance segment by segment, it handily beat analysts’ expectations. It notched $21.5 billion in revenue, a gain of 21 percent versus this same period last year. It also reported $5.97 billion in net income, a 28 percent increase year-over-year. Both of those areas saw better growth rates than last year, an impressive feat given Google’s increasingly massive scale. It's share price rose to a new all-time high.

Other Bets, made up of Alphabet’s so-called moonshot projects, reported $184 million in revenue, more than double the $74 million it booked during this same three-month period last year. Its losses also grew, although not as dramatically, increasing from $660 million in the second quarter of 2015 to $859 million this year. This section of the company houses bolder projects and acquisitions, from the home hardware company Nest, to the life sciences venture Verily, the high-speed internet project Fiber, and the development of driverless cars. Last quarter Alphabet took a step back from one of its riskier projects and put robotics firm Boston Dynamics up for sale.

Google can afford to keep losing money on moonshots

Last quarter, Alphabet posted $20.25 billion in revenue, despite Other Bets losing $802 million. That amounts to 17 percent year-over-year growth, but was down 5 percent from the last quarter of 2015. Although Other Bets posted deep losses, its revenues grew faster than losses, and at $166 million doubled compared to 2015. Nevertheless, Alphabet’s shares dropped approximately 6 percent after it posted first-quarter earnings because those numbers missed analysts estimates of $20.38 billion in revenue, according to Motley Fool.

Today the market had the opposite reaction. Google’s stock was up over 5 percent in after hours trading on the strength of its earnings report, hitting an all-time high of $810 a share. Google’s growing revenue and resilient profit margins were especially impressive in light of its expanding headcount. The company reported 66,575 employees in this quarter, a significant jump from the 57,148 it has during the same period last year.

AI is helping Google cut infrastructure costs

Sundar Pichai, Google CEO, said mobile is the core of Google's strong financial growth, and machine learning is the fuel that will power the evolution of the business through the next 10 years. Artificial intelligence has even begun to play a role in reducing infrastructure costs, with Deep Mind cutting electricity costs by optimizing energy use at Google's massive data centers. Pichai said it resulted in as much as a 40 percent reduction in energy use during a recent test, and Google plans to publish its results soon so others can experiment with its techniques.

Pichai also talked up Google's Tensor Processing Unit, a custom piece of hardware it built to optimize its cloud computing services for machine learning tasks. He claimed that by using TPUs, Google could deliver an order of magnitude better performance to customers using Google Cloud for machine learning tasks. Pichai also stated that Google had a big head start in voice recognition, and that consumers would see its strength in this area with the launch of new products like Google Home later this year.