Issue with GL period balances recalculation.

Hello there,
we have a performance problem with General ledger period balances recalculation. This process takes about 5 or 6 hours to recalculate all GL and cost accounts. The process increases every month. I run it as a batch job.
Do you know a solution for this? How can we increase performance?

Dynamics AX 2009 RU4 on SQL Server 2008