On Tue, Dec 07, 2021 at 10:55:07AM +0100, Jakub Jelinek via Gcc-patches wrote:
> So, this patch instead builds a relocation table (sorted list of addresses
> in the blob which needs relocation) at PCH save time, stores it in a very
> compact form into the gch file and upon restore, adjusts pointers in GTY
> roots (that is right away in the root structures) and the addresses in the
> relocation table.
> The cost on stdc++.gch/O2g.gch (previously 85MB large) is about 3% file size
> growth, there are 2.5 million pointers that need relocation in the gch blob
> and the relocation table uses uleb128 for address deltas and needs ~1.01 bytes
> for one address that needs relocation, and about 20% compile time during
> PCH save (I think it is mainly because of the need to qsort those 2.5
> million pointers).  On PCH restore, if it doesn't need relocation (the usual
> case), it is just an extra fread of sizeof (size_t) data and fseek
> (in my tests real time on vanilla tree for #include <bits/stdc++.h> CU
> was ~0.175s and with the patch but no relocation ~0.173s), while if it needs
> relocation it took ~0.193s, i.e. 11.5% slower.

I'll note that without PCH that
#include <bits/stdc++.h>
int i;
testcase compiles with -O2 -g in ~1.199s, i.e. 6.2 times slower than PCH with
relocation and 6.9 times than PCH without relocation.

        Jakub

Reply via email to