collapseAllGroup performance

My grid has around 1000 records, categorized in 200 different groups. Attaching to this grid is an option that allows user to switch between ungroup and group view. I have no problem with ungroup entire records, however, when switching to group view, it takes almost a minute to collapse all groups from step debug in Chrom & Firefox. Code look like below:

                grid.groupBy(2);  // 1 seconds - very surprising at the speed for more than 1000 records
                grid.sortRows(2, "str", "asc"); //1 second
                grid.collapseAllGroups(); // 45-50 second (Chrome pops up window asking to wait or to kill process 2 times)

So, what do i do to reduce the waiting time for collapseAllGroups function to complete?

There is no way to increase expanding\collasing all rows in grid. As a workaround you can try to use dhtmlxTreeGrid and reload it when you need collapse all branches