2017 was the second year running for the so-called "restaurant recession," and many restaurant brands struggled as a result of industry over-expansion. Consumers have been presented with many new options competing for their food dollars, dining preferences underwent change, and many restaurant dining rooms saw falling traffic.

That didn't mean it was a bad year to be an investor in the restaurant industry. Many stocks notched double-digit gains as they found ways to keep sales ticking higher. With only a couple weeks left in 2017, the top three performers are Yum China (NYSE:YUMC), Nathan's Famous (NASDAQ:NATH), and McDonald's (NYSE:MCD).

China love's American food

The year's top performer to date is Yum China, spun off from KFC, Pizza Hut, and Taco Bell parent company Yum! Brands (NYSE:YUM) in late 2016. The spun off company has exclusive rights to the brands in China, and is the country's largest restaurant chain.

YUMC Chart

Data by YCharts.

The company has nearly 8,000 locations, most of which are KFC and Pizza Hut. Revenues are growing thanks to 129 new restaurant openings year-to-date, as detailed in the last quarterly report, but sales have also gotten a boost from rising foot traffic at existing KFCs. Pizza Hut, which has struggled in recent years, has stabilized as the company works to update its menu to better appeal to the Chinese consumer.

Yum China may already be the industry leader in the world's most populous country, but management believes it has many years worth of growth ahead. China's middle class is still growing, and tens of millions more Chinese are expected to migrate to cities. Both trends have the potential to help KFC, Pizza Hut, and restaurant businesses, in general, continue to grow.

Shanghai skyline celebrating the year year anniversary of KFC in China by putting the brand's logo on its Pearl Tower.

KFC celebrated its 30-year anniversary in China this year. Image source: Yum China.

Hot dogs were hot this year

Nathan's Famous stock wasn't having a particularly great year until the last report for the quarter ending in September came out. Year-over-year revenues were up 13% and earnings per share up 23%. The company also announced a special $5 per share dividend. As a result, share prices quickly surged to near 40% on the year.

NATH Chart

Data by YCharts.

The New York-based hot dog company's restaurants are having their fair share of troubles, with revenues falling 6% year-to-date. Sales in its largest Branded Product segment -- which includes sales to the restaurant industry -- increased 19%, though. A licensing agreement with John Morrell Food Group to sell Nathan's Famous at grocery stores saw sales increase 20% in the quarter.

The company provides few specific updates on its quarterly operations, so it's hard to say if the recent trend will continue. Management has stated it wants to continue growing all three lines of its business -- company-operated restaurants, grocery store distribution, and food industry sales -- making Nathan's Famous a uniquely diversified entry on this year's top restaurant stock list.

A resurgent fast-food industry

While many restaurant brands struggled this year, McDonald's did not. The world's largest burger chain not only continued its growth overseas, but same-store sales in the U.S. returned to growth again, too. All-day breakfast and new menu options helped the company rekindle value-oriented consumer interests.

McDonald's has also been in the midst of refranchising many locations around the world. This paired with continued growth, especially in emerging markets, has buoyed other stocks such as Argentinian McDonald's franchisee Arcos Dorados Holdings which also had a great year.

MCD Chart

Data by YCharts.

Global comparable sales rose 6% last quarter, helping earnings per share to a hefty 55% year-over-year increase. The company also recently boosted its quarterly dividend by 7%.

Will 2017's top restaurant stock performers repeat in 2018? Maybe, but chances are some other chains will take the spot. The point is, though, that even in the midst of industrywide struggles, there are always businesses beating the trend and helping investors grow their portfolios.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.