[llvm-commits] [RFC] Use topological sorting when writing the type table
Chris Lattner
sabre at nondot.org
Tue Mar 22 22:42:02 PDT 2011
On Mar 22, 2011, at 10:35 PM, Rafael Ávila de Espíndola wrote:
> I am trying to reduce the time of LTO builds a bit. I started profiling
> gnu ar (which uses libLTO via the gold plugin) and noticed that a lot of
> time was spent in type unification.
>
> Type unification is known to be a problem when linking, but I was
> surprised to see it during 'ar' since no module was being merged. It
> turns out that it was because of forward references, which are handled
> in the reader by creating opaque types.
>
> I changed the writer to do a topological sort of the types before
> writing. The time impact is pretty impressive. The timing for producing
> libgklayout.a in the firefox build (a 49MB file) goes from
>
> real 2m4.186s
> user 2m3.591s
> sys 0m0.211s
>
> to
>
> real 0m23.944s
> user 0m23.698s
> sys 0m0.185s
>
> I have attached the proof of concept patch that does it. Would a not as
> copy and stl heavy patch implementing the same idea be OK?
Yes, I'm ok with the idea in principle if the patch were reworked. We used to do something similar but dropped it along the way. FWIW, I'm hoping to have some time in the next 6 months to do the type system rewrite, which will hopefully define this away.
-Chris
More information about the llvm-commits
mailing list