It's no surprise that it's been a great year for lots of stocks. After all, the S&P 500 has surged nearly 20%, hitting new all-time highs. But some stocks have fared exceptionally well. Two particularly outstanding performers this year are streaming-TV platform company Roku (NASDAQ:ROKU) and warehouse club Costco (NASDAQ:COST).

These two companies' stocks have crushed the market in 2019, sending shares to entirely new territory. Optimism for these stocks has been fueled by strong underlying execution from both businesses. Here's a look at the key drivers sending these stocks through the roof.

The Roku Channel displayed on a TV.

Image source: Roku.

Roku: Up 260% this year

Shares of Roku have soared more than 260% this year as of this writing. Investor sentiment toward the stock has been helped by stellar quarterly results.

In February, Roku reported a 46% year-over-year increase in fourth-quarter revenue as the company's platform revenue jumped 77% year over year. Both revenue and earnings per share during the period easily beat analysts' estimates for the two metrics.

Then Roku stepped things up a notch in Q1, when revenue growth accelerated. Total revenue rose 51% year over year as platform revenue soared 79%. Meanwhile, thanks to an expanding gross margin as the company's lucrative platform sales grew to represent a larger portion of revenue, Roku's gross profit increased at a faster rate than revenue. Gross profit in Q1 jumped 60% year over year to more than $100 million.

Roku's platform revenue, or money generated from monetizing users' engagement on the company's streaming-TV platform, has benefited from broad-based strength across ads, subscriptions, and a la carte transactions on its platform. Of course, strength in Roku's platform revenue isn't surprising considering the company's impressive user engagement; streaming hours and active accounts were up 74% and 40% year over year in Q1.

Costco: Up 38% this year

Helping Costco stock rise 38% this year have been the company's strong comparable sales growth, improvement in profitability, and continued momentum in e-commerce.

In early March, Costco said its net sales for its second quarter of fiscal 2019 increased 8.7%. Comparable sales during the period increased 6.7% when adjusted to exclude the impact of changes in gas prices, foreign exchange rates, and the adoption of a new revenue recognition standard. E-commerce sales, adjusted in the same manner, rose 25.5% over the same time frame. Finally, the quarter's earnings per share jumped from $1.59 in the second quarter of fiscal 2018 to $2.01.

Strength continued in fiscal Q3, when net sales rose 7.4% and adjusted comparable and e-commerce sales increased 5.6% and 19.5%, respectively. Earnings per share also increased nicely, rising 21% year over year to $2.05. The company's total net sales, adjusted comps, and earnings per share were all ahead of analysts' expectations for the metrics during the quarter.

More recently, Costco continued to impress when the company reported same-store sales growth for the month of June that was above analysts' expectations.

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.