Skip to content
  • Charlie Lao's avatar
    Vulkan: Use queue instead of vector for mSharedGarbageList · a7970889
    Charlie Lao authored
    The garbage collector code is iterating the mSharedGarbageList from
    begin to end and if the garbage object is completed, we destroy it and
    erase it from the vector. This is done one by one. The problem with that
    is each erase call end up moving the remaining vector to ahead by one,
    and this process is repeated for each completed element. This is O(N^2)
    problem and really magnifies when you have many garbage objects. Since
    we only add garbage when it is GPU pending, so most of these garbages
    are in sort of fifo order anyway. This CL changes the garbage list from
    vector to queue so that erase becomes pop and this becomes a O(N)
    problem. This reduces CPU overhead as measured with minimize-gpu-work
    for gardenscapes from 10ms to 2ms due to suballocation generates lots of
    garbages. But this CL is a general improvement for the garbage
    collection performance.
    
    Bug: b/215768827
    Change-Id: I002aadf75f958d8b79eb6281a2608597776e908d
    Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3414354
    
    
    Reviewed-by: default avatarShahbaz Youssefi <syoussefi@chromium.org>
    Reviewed-by: default avatarJamie Madill <jmadill@chromium.org>
    Commit-Queue: Charlie Lao <cclao@google.com>
    a7970889