JUCE HashMap performance

I still use the HashMap even though it's been somewhat obsoleted by std::map<> because std::map<> drives me bonkers that [] adds items to the map.

Anyway, HashMap was giving me some performance issues. My Key was a class that contains 4 Strings


ValueType  operator[] (KeyTypeParameter keyToLookFor) const
bool  contains (KeyTypeParameter keyToLookFor) const

Be changed to:

ValueType  operator[] (const KeyTypeParameter& keyToLookFor) const
bool  contains (const KeyTypeParameter& keyToLookFor) const

It stops a lot of Strings from being constructed and deconstructed for me.

Sure, happy to tweak that!

..actually, surely it already handles that? The KeyTypeParameter uses PARAMETER_TYPE which is supposed to choose the best form for passing that type as a parameter. Are you sure it's copying it?

You are right, it's already handled in that template magic. 

Maybe I didn't have the reference on my hash function, that could have been the issue.

std::unordered_map FTW !