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

Backend refactorings and perf improvements #6867

Merged
merged 10 commits into from
Apr 25, 2019

Commits on Apr 22, 2019

  1. Remove the Vec<Job> from DependencyQueue

    I... don't think this needed any more! Doing some digging looks like
    this was originally added in 79768eb. That was so early it didn't even
    use a PR and was almost 5 years ago. Since then we've had a huge number
    of changes to the backend and `Unit` nowadays does all the deduplication
    we need, so no need to store a `Vec` here and we can just have a mapping
    of `Key` to `Job` and that's it.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    21ea254 View commit details
    Browse the repository at this point in the history
  2. Correct a condition to request jobserver tokens

    This looks like it was a bug ever present from the original
    implementation of a GNU jobserver in rust-lang#4110, but we currently
    unconditionally request a token is allocated for any job we pull off our
    job queue. Rather we only need to request tokens for everything but the
    first job because we already have an implicit token for that job.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    b36594d View commit details
    Browse the repository at this point in the history
  3. Refactor JobQueue::run slightly

    Take a `&Context` argument instead of a few component arguments, avoids
    passing around some extraneous information.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    21cae01 View commit details
    Browse the repository at this point in the history
  4. Remove the Key type from JobQueue

    This isn't actually necessary with a bit of refactoring, and in general
    it makes management of `JobQueue` simpler since there's one less type to
    worry about. The one main usage of `Key` vs `Unit` was that `Key` was
    `Send` to be placed in `Message`, but this was replaced by just
    assigning each `Unit` an ever-increasing integer, and then `Finished`
    contains the integer rather than the `Key` itself which we can map once
    we get back to the main thread.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    12e0ffa View commit details
    Browse the repository at this point in the history
  5. Sort units once, not each call to dep_targets

    The code lying around in `dep_targets` is pretty old at this point, but
    given the current iteraiton there's no need to re-sort on each call to
    `dep_targets`, only initially during construction!
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    7246028 View commit details
    Browse the repository at this point in the history
  6. Avoid reparsing env_args continuously

    We only need to parse this information once, so calculate it when a
    `TargetInfo` is created and then just reuse that from then on out.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    bd8253f View commit details
    Browse the repository at this point in the history
  7. Intern units for fast hashing

    This commit starts to intern `Unit` structures for a few reasons:
    
    * This primarily makes equality and hashing much faster. We have tons of
      hash lookups with units, and they were showing up quite high
      in profiles. It turns out `Unit` hashes a *ton* of data, and most of
      it is always redundant. To handle this they're all only hashed once
      now and hashing/equality are just pointer checks.
    
    * The size of `Unit` is now drastically reduced to just one pointer, so
      movement of units throughout the backend should be much more
      efficient.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    e454446 View commit details
    Browse the repository at this point in the history
  8. Turn Workspace::is_member into an O(1) query

    This commit moves it from a linear query which does a lot of hashing of
    `PathBuf` to an `O(1)` query that only hashes `PackageId`. This improves
    Servo's null build performance by 50ms or so, causing a number of
    functions to disappear from profiles.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    f660b3e View commit details
    Browse the repository at this point in the history
  9. Hoist a workspace membership check out of a loop

    This commit moves a linear scan which happens once-per-each-dependency
    to an O(1) lookup which happens only once for each package. This removes
    another 30ms or so from a null build in Servo.
    alexcrichton committed Apr 22, 2019
    Configuration menu
    Copy the full SHA
    d274fba View commit details
    Browse the repository at this point in the history

Commits on Apr 23, 2019

  1. Configuration menu
    Copy the full SHA
    32269f4 View commit details
    Browse the repository at this point in the history