The stock market has performed well in 2017, with the S&P 500 up by nearly 18% and hovering near record highs. However, some stocks have performed much better than average. In fact, some of the S&P 500's components have doubled or more in 2017.

Here are the S&P 500's top five performers of the year through December's first full trading week, and a little bit about why each company has had such a great year.

Company

Recent Stock Price

YTD Gain

Align Technology (NASDAQ:ALGN)

$242.00

151.7%

NRG Energy (NYSE:NRG)

$27.72

126.1%

Micron Technology (NASDAQ:MU)

$43.36

97.8%

Vertex Pharmaceuticals (NASDAQ:VRTX)

$138.78

88.4%

Paypal Holdings (NASDAQ:PYPL)

$73.90

87.2%

Data source: TD Ameritrade. Prices and YTD performance as of 12/7/17.

1. Align Technology

Healthcare company Align Technology has been the S&P 500's biggest winner so far in 2017. The maker of Invisalign orthodontics has seen demand for its transparent tooth-straightening system soar in recent years. As my colleague Todd Campbell wrote, the company's shipment volume has risen from 363,500 cases in 2012 to 800,000 in 2016, and 2017 is shaping up to be another record year for the company.

2016 and 2017 written on a road, with arrow pointing toward sun on the horizon.

Image source: Getty Images.

As a result, the company's net income has roughly doubled over the past three years, and Align has blown past analysts' earnings expectations. More importantly, the company has captured just a small percentage of its addressable market, which means there could be much more room to grow in the years ahead.

2. NRG Energy

The stock price of integrated power company NRG Energy has more than doubled in 2017. One major catalyst was the company's transformation plan, which it announced in July, that is expected to result in more than $1 billion in recurring cost and margin improvements, at least $2.5 billion in proceeds from asset sales, and $13 billion in debt reduction. Investors were so thrilled with the company's plan that the stock popped 43% in July alone.

3. Micron Technology

Chipmaker Micron Technology has seen higher demand and lower costs that have combined to produce an excellent 2017. In fact, in the most recent quarter, Micron reported 91% year-over-year revenue growth and a $2.4 billion profit. There is a high level of demand for the company's products and constrained supply, and if these conditions continue, the company's good times could certainly continue.

4. Vertex Pharmaceuticals

Vertex Pharmaceuticals, which specializes in cystic fibrosis drugs, has been one of the market's biggest winners. Revenue has grown by 34% year over year, and adjusted EPS is up a staggering 212%. Along with its third-quarter earnings, Vertex announced positive results from a key phase 3 clinical trial that could result in a new revenue stream for the company. As a result, analysts believe that Vertex could grow its revenue at a 70% annualized rate, which could be a big driver of the strong recent performance.

5. PayPal Holdings

Over the past five full years, PayPal's revenue has grown by 91% and earnings are up 80%. Recently, the company has expanded its partnerships with credit card processors such as Visa and has added several new features to its platform, designed to appeal to more consumers. And there's good reason to believe that e-commerce growth is just getting started. In fact, as my colleague John Ballard recently wrote, the mobile payments industry is expected to grow by 33% annually through 2022, which could fuel many more years of growth for the company.

Are these stocks too expensive after such a great year?

One of the most important lessons you can learn as an investor is that just because a stock has skyrocketed doesn't necessarily mean it's expensive. If the gains are well justified by the company's earnings and/or growth, a stock can still be cheap from a long-term perspective, even if it's doubled in value or more. Conversely, just because a stock has fallen in price doesn't necessarily make it cheap.

The point is that if you're considering any stock as a long-term investment, you need to evaluate it based on its price relative to its earnings, growth, and other metrics now -- not based on what the stock's price has done over the past year.

Matthew Frankel owns shares of PayPal Holdings. The Motley Fool owns shares of and recommends Align Technology and PayPal Holdings. The Motley Fool recommends Vertex Pharmaceuticals. The Motley Fool has a disclosure policy.