The EULA (End User License Agreement, that long legal thing you check the box for so that you can play your game) forbids any modification to the game engine itself (as pretty much all game EULAs do). Having recently found the old GPG.net forums, I read the entire
28-page threadnought on Sorian's and Ducane's battle against slow sim speed.
The conclusions that were drawn from that thread, as I remember them:
- Sorian and Ducane's improvements did indeed significantly increase the sim speed, as illustrated in this graph, produced by TyrialFrost:
Note that the default AI not shown here is even worse, and I believe this is not up to date with later releases of the Sorian AI.
- Large numbers of units on the map never helped, but wasn't the main source of slowdown.
- Water maps were slowed down far more than land maps in most cases.
- In most cases the slowdown would persist after all but the AI's commander, and in some cases even that as well, were destroyed. I believe the Sorian AI was able to at least partially address this.
- Patrol routes and maps without pathing beacons (forcing the AI to resort to the canpathto() query) were the only significant resource drains caused by the units themselves, and were not the main problem. I believe these drains were also minimized.
- It was discovered that because the FA AI (as opposed to the vanilla AI) spawns a new buildmanager process for each expansion base, each expansion base essentially adds another AI to the map. The Sorian AI countered this by limiting the number of expansion bases allotted to each AI. This also helps explain why water maps were hit harder (and large maps in general), as they also contain beacons for naval expansion bases.
- It was discovered that the buildmanager for an expansion base would stay in existence even after the physical base was destroyed. Furthermore, rebuilding the base would create a new buildmanager, rather than assigning it to the already existing one. The Sorian AI ensures that the buildmanagers are destroyed properly, but the solution doesn't entirely eliminate the simspeed slowdown: the buildmanager will continue to exist until all engineers and factories associated with that base are killed, and those engineers can conceivably wander anywhere on the map.
- Some other engineer-related and excessive querying issues were found, and most were fixed or minimized. (my brain only remembers so much, it was a ton of reading)
There was steady speculation that the AI was still trying to command 'ghost units' after they had been destroyed, and that some processes were still not being culled appropriately, as you suggested. However, Sorian and Duncane were never able to find them. It's virtually certain that there is still some performance gain that could be made by modifying the lua code rather than the engine itself, but do not expect to find a single bug that will drastically increase the sim speed.
Hope that helps.