This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Go patch committed: Speed up variable initializer sorting


The Go frontend used to do variable initializer sorting by looping
through all the initialized variables and, for each one, looping
through all the initialized variables and checking for a dependency.
For very large packages with thousands of initialized global
variables, this quadratic loop could take quite a long time.

This patch changes the approach to first loop through all the
initialized variables and fetch all the references to other variables
from the initialization code.  Then, loop through them again and this
time add a dependency for each referenced, initialized, variable,
while checking for initialization loops.  We still have a nested loop,
but this time the inner loop should normally be short--just the list
of referenced variables, not the list of all variables.

Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]