• Marko Mäkelä's avatar
    Bug#16138582 MTR_MEMO_RELEASE AND DYN_ARRAY TOGETHER ARE VERY INEFFICIENT · d82eaad5
    Marko Mäkelä authored
    Get rid of O(n^2) scan in dyn array (mtr->memo) operations, accessing
    the dyn array blocks directly.
    
    dyn_array_get_last_block(), dyn_array_get_next_block(),
    dyn_array_get_prev_block(): Define as a constness-preserving macro.
    
    Add const qualifiers to many dyn_array functions.
    
    mtr_memo_slot_release_func(): Renamed from mtr_memo_slot_release():
    Make mtr_t* a debug-only parameter. Assume that slot->object != NULL.
    
    mtr_memo_pop_all(): Access the dyn_array blocks directly, replacing
    O(n^2) operation with O(n).
    
    mtr_memo_release(): Access the dyn_array blocks directly, replacing
    O(n^2) operation with O(n). This caused the performance problem.
    
    rb#1540 approved by Jimmy Yang
    d82eaad5
dyn0dyn.c 1.83 KB