I've uploaded some performance changes.
It was slow because the AI was waiting for the next timeslice whenever it split a unit selection group. (I'm talking about game-engine timeslices, not CPU processing timeslices.)
I can't think of any reason to wait for that. The group gets split, presumably the units get put into new groups... and that's all that happens. As far as I can tell, there is no reason for the AI not to continue issuing commands in the same timeslice. So in my new code, it will still continue to issue commands for the rest of its groups.
It's worth noting that the new groups that come from the split will have to wait for the next timeslice anyway, because they won't be in the sorted list of selection groups in AI_unitUpdate. The worst possible side effect that I can think of is that the new groups (from the split) will have their action performed last - even if they have high (low number) unit priority. Indeed, that is a negative side effect, but in my view it's quite a minor one, and one worth paying for the massive speed gains.