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

Overhaul FileSearch and SearchPaths #56090

Merged
merged 6 commits into from
Dec 13, 2018
Merged

Commits on Dec 11, 2018

  1. Configuration menu
    Copy the full SHA
    0238bcc View commit details
    Browse the repository at this point in the history
  2. Remove Session::sysroot().

    Instead of maybe storing its own sysroot and maybe deferring to the one
    in `Session::opts`, just clone the latter when necessary so one is
    always directly available. This removes the need for the getter.
    nnethercote committed Dec 11, 2018
    Configuration menu
    Copy the full SHA
    2640da7 View commit details
    Browse the repository at this point in the history
  3. Introduce SearchPath and replace SearchPaths with Vec<SearchPath>.

    It's more idiomatic, makes the code shorter, and will help with the next
    commit.
    nnethercote committed Dec 11, 2018
    Configuration menu
    Copy the full SHA
    f130061 View commit details
    Browse the repository at this point in the history
  4. Avoid regenerating the Vec<PathBuf> in FileSearch::search().

    `FileSearch::search()` traverses one or more directories. For each
    directory it generates a `Vec<PathBuf>` containing one element per file
    in that directory.
    
    In some benchmarks this occurs enough that the allocations done for the
    `PathBuf`s are significant, and in practice a small number of
    directories are being traversed over and over again. For example, when
    compiling the `tokio-webpush-simple` benchmark, two directories are
    traversed 58 times each. Each of these directories have more than 100
    files.
    
    This commit changes things so that all the `Vec<PathBuf>`s that will be
    needed by a `Session` are precomputed when that `Session` is created;
    they are stored in `SearchPath`. `FileSearch` gets a reference to the
    necessary `SearchPath`s. This reduces instruction counts on several
    benchmarks by 1--5%.
    
    The commit also removes the barely-used `visited_dirs` hash in
    `for_each_lib_searchPath`. It only detects if `tlib_path` is the same as
    one of the previously seen paths, which is unlikely.
    nnethercote committed Dec 11, 2018
    Configuration menu
    Copy the full SHA
    2bfe32c View commit details
    Browse the repository at this point in the history
  5. Replace FileSearch::for_each_lib_search_path with search_paths.

    Returning an iterator leads to nicer code all around.
    nnethercote committed Dec 11, 2018
    Configuration menu
    Copy the full SHA
    95a6262 View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2018

  1. Remove some env vars for rustdoc invocations.

    In an attempt to avoid "thread '<unnamed>' panicked at 'failed to
    acquire jobserver token: Bad file descriptor" errors.
    nnethercote committed Dec 12, 2018
    Configuration menu
    Copy the full SHA
    209240d View commit details
    Browse the repository at this point in the history