While looking for things to optimize I looked at the identity component, as apparently it's one of the slowest to be created because of the caching.
That component calls GetIdentityClasses which according to my profiling takes about 17-23µs to execute. This patch cuts this by half.
This function is called a lot on map generation (to create all entities) but also by the AI in entity.js, each time you open a detail window on a unit (some times more than 20 times) to put stuff in cache. So we might be able able to get back a few ms here and there to do other things