Skip to content

Rollup of 4 pull requests #29778

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

Merged
merged 16 commits into from
Nov 11, 2015
Merged

Rollup of 4 pull requests #29778

merged 16 commits into from
Nov 11, 2015

Conversation

GuillaumeGomez and others added 15 commits November 10, 2015 00:43
pass around references instead of boxed values to save on clone costs.
before we iterated over the test and each outcome thereof, and then
checked processed every candidate against this outcome, we now organize
the walk differently. Instead, we visit each candidate and say "Here is
the test being performed. Figure out the resulting candidates for each
possible outcome and add yourself into the appropriate places."
The older algorithm was pretty inefficient for big matches. Fixes rust-lang#29227. (On my computer, MIR construction on this test case goes from 9.9s to 0.025s.) Whereas before we had a loop like:

- for all outcomes of the test we are performing
    - for all candidates
        - check whether candidate is relevant to outcome

We now do:

- for all candidates
    - determine which outcomes the candidate is relevant to

Since the number of outcomes in this case is proportional to the number of candidates, the original algorithm turned out to be O(n^2), and the newer one is just O(n).

This PR also does some minor speedups by eagerly mirroring all patterns, so that we can just pass around `&Pattern<'tcx>`, which makes cloning cheaper. We could probably go a bit further in this direction.

r? @Aatch
It's a bit strange to expect users of `libstd` to require the use of an external crates.io crate to work with standard types. This commit encourages the use `os::raw::c_char` instead, although users are certainly free to use `libc::c_char` if they wish; the test still exists to ensure the two types are identical (though the reported bug only exists on platforms that are not officially tested).

Fixes rust-lang#29774
@Manishearth
Copy link
Member Author

@bors r+ p=10 force

@bors
Copy link
Collaborator

bors commented Nov 11, 2015

📌 Commit 98b5285 has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Nov 11, 2015

⌛ Testing commit 98b5285 with merge 53d6288...

@bors
Copy link
Collaborator

bors commented Nov 11, 2015

💔 Test failed - auto-mac-64-opt

@Manishearth
Copy link
Member Author

@bors r+ p=10 force

@bors
Copy link
Collaborator

bors commented Nov 11, 2015

📌 Commit 2670565 has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Nov 11, 2015

⌛ Testing commit 2670565 with merge b8eaa16...

bors added a commit that referenced this pull request Nov 11, 2015
@bors bors merged commit 2670565 into rust-lang:master Nov 11, 2015
@Manishearth Manishearth deleted the rollup branch November 11, 2015 22:24
@Centril Centril added the rollup A PR which is a rollup label Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rollup A PR which is a rollup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants