Skip to content
  • Eric Wong's avatar
    http-walker: reduce O(n) ops with doubly-linked list · 94e99012
    Eric Wong authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    Using the a Linux-kernel-derived doubly-linked list
    implementation from the Userspace RCU library allows us to
    enqueue and delete items from the object request queue in
    constant time.
    
    This change reduces enqueue times in the prefetch() function
    where object request queue could grow to several thousand
    objects.
    
    I left out the list_for_each_entry* family macros from list.h
    which relied on the __typeof__ operator as we support platforms
    without it.  Thus, list_entry (aka "container_of") needs to be
    called explicitly inside macro-wrapped for loops.
    
    The downside is this costs us an additional pointer per object
    request, but this is offset by reduced overhead on queue
    operations leading to improved performance and shorter queue
    depths.
    
    Signed-off-by: default avatarEric Wong <e@80x24.org>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    94e99012