Check for unconstrained hash equality before constrained hash equality.
This patch implements a simple optimization in __hash_table::find. When iterating the found bucket we only constrain the bucket elements hash if it doesn't already match the unconstrained hash of the specified key. This prevent the performance of an expensive modulo operation. Since the bucket element almost always matches the key, especially when the load factor is low, this optimization has large performance impacts. For a unordered_set<int> of random integers this patch improves the performance of 'find(...)' by 40%. llvm-svn: 275734
Loading
Please register or sign in to comment