Mentioning the benchmark you used in the description would have been helpful to see what we get for the extra complexity.
On Fri, Jun 12, 2015, 3:15 PM Benjamin Kramer <[email protected]> wrote: > Author: d0k > Date: Fri Jun 12 08:06:57 2015 > New Revision: 239604 > > URL: http://llvm.org/viewvc/llvm-project?rev=239604&view=rev > Log: > [clang-format] Hoist vector allocation out of loop. NFC. > > Modified: > cfe/trunk/lib/Format/FormatToken.cpp > > Modified: cfe/trunk/lib/Format/FormatToken.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Format/FormatToken.cpp?rev=239604&r1=239603&r2=239604&view=diff > > ============================================================================== > --- cfe/trunk/lib/Format/FormatToken.cpp (original) > +++ cfe/trunk/lib/Format/FormatToken.cpp Fri Jun 12 08:06:57 2015 > @@ -203,11 +203,14 @@ void CommaSeparatedList::precomputeForma > > // We can never place more than ColumnLimit / 3 items in a row (because > of the > // spaces and the comma). > - for (unsigned Columns = 1; Columns <= Style.ColumnLimit / 3; ++Columns) > { > + unsigned MaxItems = Style.ColumnLimit / 3; > + std::vector<unsigned> MinSizeInColumn; > + MinSizeInColumn.reserve(MaxItems); > + for (unsigned Columns = 1; Columns <= MaxItems; ++Columns) { > ColumnFormat Format; > Format.Columns = Columns; > Format.ColumnSizes.resize(Columns); > - std::vector<unsigned> MinSizeInColumn(Columns, UINT_MAX); > + MinSizeInColumn.assign(Columns, UINT_MAX); > Format.LineCount = 1; > bool HasRowWithSufficientColumns = false; > unsigned Column = 0; > > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
