Using fFilterValues.reset() or a loop of fFilterValues.push_back() is about 5x slower than calling fFilterValues.resize_back() and then looping using primitive [] and =.
This is only going to show up if you apply https://codereview.chromium.org/
183763047/, where it yields about 2.5% speedup in the bitmap resize microbenchmarks on a Linux desktop. Ceteris paribus, it should actually improve rasterization time of drawBitmapRectToRect() with a resize by about 5% in Chromium.
BUG=skia:2258
R=humper@google.com, tomhudson@google.com
Author: tomhudson@chromium.org
Review URL: https://codereview.chromium.org/
184323003
git-svn-id: http://skia.googlecode.com/svn/trunk@13681
2bbb7eff-a529-9590-31e7-
b0007b416f81
filterLength = lastNonZero + 1 - firstNonZero;
SkASSERT(filterLength > 0);
+ // Calling fFilterValues.reset(), or push_back() in a loop, are expensive.
+ fFilterValues.resize_back(filterLength);
for (int i = firstNonZero; i <= lastNonZero; i++) {
- fFilterValues.push_back(filterValues[i]);
+ fFilterValues[i - firstNonZero] = filterValues[i];
}
} else {
// Here all the factors were zeroes.