The question (which has been hounding the AI guys since I was doing it!) is what you give up in flexibility to allow better performance. If I recall, the main issues tend to be things like distance calculations and movement stuff (in particular things like resources, where one was continually cycling through all the workers on the map, then for each of those calculating distances to every tree on the map to work out which was closest), but I don't know how integrated those are now anyway, I'm pretty out of the loop. Out of interest, as a general ballpark idea, if one literally hardcoded the entire AI in C++ would all the above times become negligible/near instantaneous? I don't really know how big the JS penalty is and how much it's just that the AI is making too many calculations - because the alternative to pushing more into C++ is to work out a way to do less to start with.