I discovered a bottleneck in the cleanup process in AngelScript which caused our game to take much longer to shutdown than expected. It seems that all the time was being spent in ClearUnusedTypes() which used a linear search for removing types.

I replaced the vector with a set (emulated with a map, to be able to use the same data structures the library normally uses), removing the bottleneck. We've been using this change for a few weeks without issue.