Yes, your observation was correct. There have been an abnormally large number of people walking around hiding yawns behind their hands. 

Wild market swings can have that effect, inspiring fear and increasing insomnia. 

But for some, the loss of sleep is due to excitement -- excitement at the bargains to be found in the market. Let's look at two popular solar stocks, Canadian Solar (NASDAQ:CSIQ) and Trina Solar (NYSE:TSL), to see which one offers a better bargain.

Who's who
Canadian Solar and Trina Solar are two Chinese companies involved in the production of photovoltaic, or PV, panels. Operating in the residential, commercial, and utility-scale markets, both companies are industry leaders that maintain a global presence. According to the research firm IHS, Trina Solar ranked first in shipments of PV modules in 2014; Canadian Solar ranked third. Despite this impressive performance, shares of both stocks have been hit pretty hard over the past year. 
TSL Chart

TSL data by YCharts

Focusing on financials
Solar has become an increasingly viable option for consumers, and both Trina and Canadian Solar have played large roles in supplying the PV modules to the market. When it comes to top-line growth, Canadian Solar has been much more successful. Over the past five years, Trina's revenue has grown by 23% while Canadian Solar's revenue growth clocks in at a much more impressive 98%. 

More importantly, though, is whether the companies have managed to control costs while driving that revenue growth. At this point, solar panels have become more or less a commodity, so a company's ability to keep its cost of goods in check is crucial. In this regard, Trina outshines Canadian Solar. Trina has bested Canadian Solar in the ability to reign in costs over the short and long term. Quarter over quarter, Trina's gross margin improved by 200 basis points while Canadian Solar's declined by 260 basis points. Year over year, Trina's gross margin improved by 460 basis points while Canadian Solar's declined by 370 basis points. 

Screen Shot

Examining the companies' operating margins, one finds a similar story. Trina has proved the ability to consistently improve over the past year. In doing so, it reported operating income of $60.7 million for the second quarter of 2015 -- a 286.5% improvement over the $15.7 million that it reported in second quarter of 2014. Canadian Solar, on the other hand, has consistently declined over the past year to keep its operating costs in check.

Screen Shot

The good news for Trina Solar continues all the way down to the bottom line. Reporting net income of $43.1 million in the second quarter, an improvement of 318% year over year. Conversely, Canadian Solar has seen its profitability suffer greatly over the past year. For the second quarter, the company reported net income of $17.9 million -- a 68% decline from the $55.8 million it reported in the second quarter of 2014.

Better value?
With Canadian Solar's shares trading at a P/E of 4.17 and Trina's shares trading at a 10.01 ratio, it might be tempting to favor Canadian Solar. But here's a good example of how this one ratio can be misleading. Canadian Solar shares are trading so inexpensively for good reason -- it's in a bit of a tailspin. During the last earnings call, management didn't reassure investors, guiding for revenue to land between $570 million and $620 million in the third quarter. Should the company's revenue come in at $595 million, falling in the middle of that range, it would mark another quarter of deteriorating performance -- a 6.6% sequential decline and a 34.9% decline year over year. Management also guided for its gross margin to fall between 12% and 14%, slipping even further than it already has over the past year.

Trina, in its earning release, didn't offer as much in the way of guidance for the next quarter and the full year. It did, however, raise the guidance on its module shipments for 2015; it now expects to ship between 4.9 GW and 5.2 GW worth of PV modules. In providing this revision, the company is expecting to expand its global presence. In 2014, Trina had module shipments of 3.4 GW outside China, and in 2015, it is guiding for shipments outside China to grow to between 4.1 GW and 4.4. GW. For comparison, Canadian Solar is guiding to ship between 4.0 GW and 4.3 GW worth of modules for 2015. 

The takeaway
Trina Solar and Canadian Solar offer two viable options for investing in the solar-energy industry. Though both companies are profitable, something not too common among Chinese PV module manufacturers, there is much more to consider if contemplating an investment in either company. Yieldcos have been all the rage in the solar and wind industries over the past few years, and Canadian Solar is no exception. It is planning on launching its own yieldco at the end of the year or early next year. Although management has high hopes for this new business model, it seems to be a distraction -- compromising the company's performance over the past year. At the moment, Trina Solar, despite a higher P/E, appears to offer a more compelling value and warrants a closer look for those who may wish to open a position. 

Scott Levine has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.