When a cursor is opened we compute a hash value based on the given URI. We use that to select a hash bucket and look for a cached cursor in that bucket. If we can't find it, we create a new cursor.
When a cursor is closed, we want to release it to the cache, and we potentially compute the hash value again. We do this (paraphrased) code:
if (cursor->uri_hash == 0) cursor->uri_hash = hash_function(uri); bucket = cursor->uri_hash % HASH_SIZE; TAILQ_INSERT_HEAD(&session->cursor_cache[bucket], cursor, q);
When the cursor is first created, if we can fill cursor->uri_hash with the hash value that we computed when looking in the hash table, we'll do one less hash call in the life of the cursor.
This might add up especially for use cases that have huge number of collections that are seldom reused in a session.