• Filipe Oliveira (Redis)'s avatar
    Optimize LREM, LPOS, LINSERT, LINDEX: Avoid N-1 sdslen() calls on listTypeEqual (#13529) · bcae7708
    Filipe Oliveira (Redis) authored
    This is a very easy optimization, that avoids duplicate computation of
    the object length for LREM, LPOS, LINSERT na LINDEX.
    
    We can see that sdslen takes 7.7% of the total CPU cycles of the
    benchmarks.
    
    Function Stack | CPU Time: Total | CPU Time: Self | Module | Function
    (Full) | Source File | Start Address
    -- | -- | -- | -- | -- | -- | --
    listTypeEqual | 15.50% | 2.346s | redis-server | listTypeEqual |
    t_list.c | 0x845dd
    sdslen | 7.70% | 2.300s | redis-server | sdslen | sds.h | 0x845e4
    
    Preliminary data showcases 4% improvement in the achievable ops/sec of
    LPOS in string elements, and 2% in int elements.
    bcae7708
t_list.c 47.6 KB