Warren Buffett is a legendary investor and one of the world's wealthiest people. While his start at a very early age helped him build a fortune, Buffett hasn't lost his investing touch.

His holding company, Berkshire Hathaway (BRK.A -0.76%) (BRK.B -0.69%), has outperformed the S&P 500 index over the past 20 years. Had you invested $10,000 in Berkshire Hathaway in 2003, you would have more than $71,000 today to the S&P 500's $62,200.

Berkshire Hathaway trades near its all-time high today, so investors could wonder if they've missed the train. After all, Berkshire is one of the world's largest companies, valued at nearly $800 billion in market cap.

Here is what you need to know.

Berkshire Hathaway is a recession-proof investment

Buffett has built Berkshire Hathaway into a juggernaut to survive almost any realistic economic scenario. The company's many businesses center primarily around pick-and-shovel industries crucial to running the economy.

Berkshire's first business segment is its railroads, utilities, and energy assets. The company owns BNSF Railway, one of North America's largest rail networks with over 32,000 miles. Due to its pipeline assets, the company owns roughly one-fifth of U.S. interstate natural gas transports. The economy might ebb and flow, but these businesses are always running.

The company's next segment is insurance and other, headlined by its ownership of GEICO. It's America's second-largest automotive insurance company, with an estimated 14% market share in the United States. Again, people must insure their vehicles, so this is another asset that reliably generates earnings for Berkshire.

Berkshire also owns a tremendous stock portfolio, but the reported gains and losses from changing share prices are noncash items unless Berkshire sells stock. The company's operating earnings were $21.1 billion through the first half of this year, up from $15.3 billion the prior year's first six months -- again, pulling out the gains/losses from Berkshire's portfolio.

Hypothetically, imagine that an economic catastrophe occurs, and Berkshire's business begins losing money on an operating basis (you can see from the chart below how unlikely that is):

BRK.B Cash from Operations (TTM) Chart

BRK.B Cash from Operations (TTM) data by YCharts

Berkshire is famous for hoarding cash on its balance sheet. Today, it has a staggering $142 billion in cash, equivalents, or short-term Treasury bonds. It's a massive pile of easily accessible cash that makes for a great safety net should anything go unexpectedly wrong. In other words, Berkshire might be the closest thing to a recession-proof business there is.

But the stock is getting a little pricey

Berkshire is a massive company with many different businesses and stakes in other companies. So, using book value to track the stock's value can be helpful. You can see below that Berkshire's value has steadily grown over the years. Berkshire retains all of its earnings instead of paying dividends.

BRK.B Book Value (Quarterly) Chart

BRK.B Book Value (Quarterly) data by YCharts

That track record of growth and the company's highly resilient financials help explain why Buffett has such a following and why shareholders have done so well with Berkshire stock over time. However, if you look at the stock's price-to-book value ratio (P/B) today, it's sitting above its average over the past decade. And while a recession may not stop Berkshire's businesses, it could weigh on them, so paying a premium for the stock may not make sense.

BRK.B Price to Book Value Chart

BRK.B Price to Book Value data by YCharts

Berkshire Hathaway seems poised to continue steadily increasing in value for years to come, thanks to the company Warren Buffett has built over his lifetime. But great companies can be poor investments if the valuation isn't right. Berkshire's recent share-price momentum may indicate that investors should wait for a better entry point.