Currently, the QUERY hash table in the property API is being treated like a list in a commonly used path. If ossl_method_store_cache_get is called with a null provider, the hash table is traversed with a doall iterator, meaning that each node is visited looking for a match on the property string. In effect creating a 'best match' lookup heuristic. this is repeated ad nauseum for each call to ossl_method_store_cache_get.
We can improve on this significantly by doing the following:
1) On a call to oss_method_store_cache_get, do a lookup in the hash table using the key <prop_query, provider>, with provider set to null/no provider.
2) If no entry is returned, do the table walk to find the 'best match' as described above. When a best match is found, add an entry to the query table with that prop_query and a null provider as a tuple. This will ensure that subsequent lookups will find this best match using the fast path in (1)
3) Flush the query table any time a provider is added/removed to ensure that a better 'best match' doesn't exist now.
4) Add a test to ensure that loading a new provider clears the cache and realoads with new queries
5) Check and augment performance test to ensure that performance is improved
Currently, the QUERY hash table in the property API is being treated like a list in a commonly used path. If ossl_method_store_cache_get is called with a null provider, the hash table is traversed with a doall iterator, meaning that each node is visited looking for a match on the property string. In effect creating a 'best match' lookup heuristic. this is repeated ad nauseum for each call to ossl_method_store_cache_get.
We can improve on this significantly by doing the following: 1) On a call to oss_method_store_cache_get, do a lookup in the hash table using the key <prop_query, provider>, with provider set to null/no provider. 2) If no entry is returned, do the table walk to find the 'best match' as described above. When a best match is found, add an entry to the query table with that prop_query and a null provider as a tuple. This will ensure that subsequent lookups will find this best match using the fast path in (1) 3) Flush the query table any time a provider is added/removed to ensure that a better 'best match' doesn't exist now. 4) Add a test to ensure that loading a new provider clears the cache and realoads with new queries 5) Check and augment performance test to ensure that performance is improved