increases in our contract revenues in our Energy segment as described above, as well as the ramping up of new projects for which we saw higher project startup costs relative to the revenue recognized.
Direct costs of contract revenue in our Energy segment increased $18.4 million, or 41.6%, in the three months ended July 1, 2022, compared to the three months ended July 2, 2021. Direct costs of contract revenue for the Engineering and Consulting segment decreased $0.6 million, or 6.7%, in the three months ended July 1, 2022, compared to the three months ended July 2, 2021.
Subcontractor services and other direct costs increased by $12.9 million, or 34.9%, and salaries and wages increased by $4.9 million, or 30.1%, in the three months ended July 1, 2022, compared to the three months ended July 2, 2021, primarily due to the increases in contract revenues as described above combined with changes in the mix of those contract revenues to those which contain a higher percentage of material costs and installation subcontracting and lower percentage of labor costs, as well as the ramping up of new projects for which we saw higher project startup costs relative to the revenue recognized.
Gross Profit. Gross profit increased 2.3% to $31.6 million, or 30.8% gross margin, for the three months ended July 1, 2022, compared to gross profit of $30.9 million, or 36.7% gross margin, for the three months ended July 2, 2021. The decrease in our gross margin was primarily driven by changes in the mix of revenues as described above combined with the ramping up of new projects for which we saw higher project startup costs relative to the revenue recognized.
General and administrative expenses. General and administrative (“G&A”) expenses decreased by $1.1 million, or 2.8%, in the three months ended July 1, 2022 compared to the three months ended July 2, 2021. The decrease in G&A expenses consisted of a decrease of $3.1 million in unallocated corporate expense, partially offset by an increase of $1.0 million in the Energy segment and an increase of $1.0 million in the Engineering and Consulting segment. The decrease in G&A expenses was primarily attributed to lower stock-based compensation expenses, partially offset by higher salaries and wages, payroll taxes and employee benefits combined with higher computer-related expenses and professional service fees.
Within G&A expenses, the decrease of $4.2 million in stock-based compensation was partially offset by an increase of $1.7 million in salaries and wages, payroll taxes and employee benefits, combined with an increase of $1.2 million in other general and administrative expenses, and an increase of $0.2 million in depreciation and amortization. Facilities and facility related expenses were relatively flat for the three months ended July 1, 2022, compared to the three months ended July 2, 2021. The decrease in stock-based compensation expenses was primarily related to previously awarded stock grants reaching the end of their corresponding vesting periods. The increase in salaries and wages, payroll taxes and employee benefits was primarily due to increases in personnel. The increase in other general and administrative expenses was primarily due to higher computer-related expenses and professional service fees. The increase in depreciation and amortization was primarily related to higher depreciation of internally-developed computer software.
Income (loss) from operations. Operating loss was $5.3 million for the three months ended July 1, 2022 as a result of the factors noted above. As a percentage of contract revenue, operating loss decreased from 8.4% to 5.2% for the three months ended July 1, 2022, compared to the three months ended July 2, 2021.
Total other expense, net. Total other expense, net, decreased $0.5 million, or 41.2%, for the three months ended July 1, 2022, compared to the three months ended July 2, 2021, as a result of income from indemnification agreements and lower interest expense related to principal reductions in term loans.
Income tax expense (benefit). We recorded an income tax benefit of $1.7 million for the three months ended July 1, 2022, compared to a tax benefit of $3.7 million for the three months ended July 2, 2021. The decrease in the tax rate is primarily attributable to a one-time benefit derived from the CARES Act that was realized in the three months ended July 2, 2021, and that did not recur in the three months ended July 1, 2022.
Net income (loss). Our net loss was $4.3 million for the three months ended July 1, 2022, as compared to a net loss of $4.6 million for the three months ended July 2, 2021. The improvement in net loss was primarily attributable to