Builders FirstSource posted a loss from continuing operations of $12 million in the second quarter, a $3 million improvement from the year-earlier period, despite a 32% jump in sales to $271.9 million.

Gross profit rose 25% to $53.7 million, though gross margin percentage slipped one percentage point to 19.7%. Loss from operations improved from $8 million to $1.4 million.

The Dallas-based supplier did manage to swing its adjusted EBITDA into the black with earnings of $2.1 million. The company defines adjusted EBITDA as GAAP net income (loss) before depreciation and amortization, interest expense, income taxes, (gain) loss on sale of assets, (income) loss from discontinued operations, and other non-cash or special items including asset impairments, facility closure costs, severance, transaction costs, and stock compensation expense.

“We delivered our best operating performance in nearly five years,” CEO Floyd Sherman said in a statement.

Adjusted loss from continuing operations was $7.1 million, an improvement from the $7.4 million loss in 2011’s second quarter. The company defines adjusted loss from continuing operations as GAAP income (loss) from continuing operations before non-cash or special items including facility closure costs, stock warrant fair value adjustments, and tax valuation allowances.

The prefabricated components unit reported a 27% increase in sales to $51.2 million, while sales at its window and doors division also rose 27% to $59.3 million. Sales at the lumber and lumber sheet goods product category skyrocketed 45% to $87.9 million. The millwork unit revealed a 23% growth in sales to $26.4 million, while the other building products and services reported sales of $47.1 million, good for a 26% jump.