[PATCH] D27960: Use exact vector capacities to store DWARF line tables

Simon Que via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 13:01:06 PST 2016


sque added a comment.

In https://reviews.llvm.org/D27960#627364, @mehdi_amini wrote:

> I'd like to see such a reduction *with this patch alone*, and have an explanation for it, before considering moving forward in any way.


Here are some new numbers. First value is max RSS in kB, and second value is duration in seconds. I ran each four times. The first run took a little longer, presumably because of the time it took to load the executables for the first time.

A: Without this patch
---------------------

6319548 21.26
6193428 17.04
6455776 17.92
6403748 17.28

B1: With this change (shrink_to_fit)
------------------------------------

5475640 15.26
5722124 15.13
5735732 14.69
5605456 14.06

B2: With reserving new vector instead of shrink_to_fit
------------------------------------------------------

3138480 5.79
3136468 5.06
3136444 5.12
3138528 5.19

I counted the nominal number of kB saved by reducing vector capacities: 812400. This is about the difference in max RSS between A and https://reviews.llvm.org/B1.

But https://reviews.llvm.org/B2 had a much larger reduction in both max RSS and runtime duration even though it accomplishes the same thing. https://reviews.llvm.org/B2 does the following instead of calling shrink_to_fit (see https://reviews.llvm.org/D27883):

  std::vector<DWARFDebugLine::Row> compactRows;
  compactRows.reserve(Rows.size());
  std::copy(Rows.begin(), Rows.end(), compactRows.begin());
  Rows = std::move(compactRows);


https://reviews.llvm.org/D27960





More information about the llvm-commits mailing list