[llvm-commits] [RFC] Use topological sorting when writing the type table

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Tue Mar 22 22:35:28 PDT 2011


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?

Cheers,
Rafael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sort.patch
Type: text/x-patch
Size: 4105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20110323/4636d620/attachment.bin>


More information about the llvm-commits mailing list