I was looking through the material code, and I was wondering why Material used a
HashMap<TextureUnit, SharedPtr<Texture> > rather than a
Vector<SharedPtr<Texture>> or even just a
SharedPtr<Texture>[(int)MAX_TEXTURE_UNITS] to store its textures?
Even on a 64 bit system that should only require 128 bytes on Desktop, so ~8000 materials to get 1 Megabyte of extra memory used by using the fixed size array (assuming there were no textures in any of the material - the more units that are used, the less the comparative increase, and presumably at the point of having thousands of materials that will be negligible compared to the number of textures in use). From my (limited) understanding, using an array of contiguous memory should be faster than using the HashMap, and that would reduce checking if a texture unit is present to simply checking against nullptr rather than having to check the map.
Granted, I may have just missed something that should make it obvious, or may be misunderstanding the map-vs-array tradeoff.