Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rustc: Preallocate when building the dep graph #44586

Merged
merged 1 commit into from
Sep 17, 2017

Commits on Sep 15, 2017

  1. rustc: Preallocate when building the dep graph

    This commit alters the `query` function in the dep graph module to preallocate
    memory using `with_capacity` instead of relying on automatic growth. Discovered
    in rust-lang#44576 it was found that for the syntex_syntax clean incremental benchmark
    the peak memory usage was found when the dep graph was being saved, particularly
    the `DepGraphQuery` data structure itself. PRs like rust-lang#44142 which add more
    queries end up just making this much larger!
    
    I didn't see an immediately obvious way to reduce the size of the
    `DepGraphQuery` object, but it turns out that `with_capacity` helps quite a bit!
    Locally 831 MB was used [before] this commit, and 770 MB is in use at the peak
    of the compiler [after] this commit. That's a nice 7.5% improvement! This won't
    quite make up for the losses in rust-lang#44142 but I figured it's a good start.
    
    [before]: https://gist.github.com/alexcrichton/2d2b9c7a65503761925c5a0bcfeb0d1e
    [before]: https://gist.github.com/alexcrichton/6da51f2a6184bfb81694cc44f06deb5b
    alexcrichton committed Sep 15, 2017
    Configuration menu
    Copy the full SHA
    a7817dd View commit details
    Browse the repository at this point in the history