Avoid vector::insert in base::OffsetAdjuster::MergeSequentialAdjustments
This CL trades space for time in |MergeSequentialAdjustments|. By allocating a new |Adjustments| vector, we can avoid calling |std::vector::insert| in a loop, which costs roughly O(n^2) time. With the additional vector, we only need to call |std::vector::push_back|, costing roughly O(n) time in total. Bug: 1017193 Change-Id: I7beb2c3c0b6a9cb7616a22f4a4355285fd281894 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2070605Reviewed-by:Daniel Cheng <dcheng@chromium.org> Commit-Queue: Dan McArdle <dmcardle@chromium.org> Cr-Commit-Position: refs/heads/master@{#746171}
Showing
Please register or sign in to comment