Commit dc23fb4d by Ian Lance Taylor

compiler: speed up variable initializer sorting

    
    The compiler 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.
    
    Change 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.
    
    Reviewed-on: https://go-review.googlesource.com/116816

From-SVN: r261284
parent fa725532
baf289294a026ddd30c9e4341aff528084337763
3ec698690d2a8ecbf115489f17d85e848a2f7293
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment