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

Avoid some pat_to_string calls. #37014

Merged
merged 1 commit into from
Oct 8, 2016

Conversation

nnethercote
Copy link
Contributor

ty_of_method_or_bare_fn currently calls pat_to_string even when it
doesn't need to. Fixing this avoids hundreds of large allocations (e.g.
171,600 bytes, in mk_printer) in several of rustc-benchmarks.

@rust-highfive
Copy link
Collaborator

r? @Aatch

(rust_highfive has picked a reviewer for you, use r? to override)

@arielb1
Copy link
Contributor

arielb1 commented Oct 7, 2016

You only need to call pat_to_string when there is an error. Move it into a closure.

`ty_of_method_or_bare_fn` currently calls `pat_to_string` even when it
doesn't need to. Fixing this avoids hundreds of large allocations (e.g.
171,600 bytes, in `mk_printer`) in several of the rustc-benchmarks.
@nnethercote
Copy link
Contributor Author

I moved the pat_to_string call into a closure as requested.

r? @arielb1

@rust-highfive rust-highfive assigned arielb1 and unassigned Aatch Oct 7, 2016
@arielb1
Copy link
Contributor

arielb1 commented Oct 7, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Oct 7, 2016

📌 Commit e5ffade has been approved by arielb1

@bors
Copy link
Contributor

bors commented Oct 8, 2016

⌛ Testing commit e5ffade with merge 195dbfa...

bors added a commit that referenced this pull request Oct 8, 2016
Avoid some `pat_to_string` calls.

`ty_of_method_or_bare_fn` currently calls `pat_to_string` even when it
doesn't need to. Fixing this avoids hundreds of large allocations (e.g.
171,600 bytes, in `mk_printer`) in several of rustc-benchmarks.
@bors bors merged commit e5ffade into rust-lang:master Oct 8, 2016
@nnethercote nnethercote deleted the avoid-pat_to_string branch October 8, 2016 10:13
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this pull request Dec 6, 2016
@nnethercote added the optimization that find_implied_output_region
takes a closure as an optimization in rust-lang#37014, but passing an iterator is
simpler, and more ergonomic for callers.
bors added a commit that referenced this pull request Dec 6, 2016
Simplify calling find_implied_output_region.

@nnethercote added the optimization that find_implied_output_region
takes a closure as an optimization in #37014, but passing an iterator is
simpler, and more ergonomic for callers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants