Optimize CPU cache efficiency on dict while it's being rehashed (#5692)
when find a key ,if redis is rehashing, currently we should lookup both tables (ht[0] and ht[1]). if we use the key's index comparing to the rehashidx,if index < rehashidx,then we can conclude: 1. it is rehashing(rehashidx is -1 if it is not rehashing) 2. we can't find key in ht[0] so just continue to find key in ht[1] The possible performance gain here, is not the looping over the linked list (which is empty), but rather the lookup in the table (which could be a cache miss). --------- Co-authored-by:zhangshihua003 <zhangshihua003@ke.com> Co-authored-by:
sundb <sundbcn@gmail.com> Co-authored-by:
Oran Agra <oran@redislabs.com> Co-authored-by:
judeng <abc3844@126.com>
Please register or sign in to comment