about summary refs log tree commit diff
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-06-08 07:05:44 +0800
committerGitHub <noreply@github.com>2018-06-08 07:05:44 +0800
commit326331c34f70617c3e779c6bf8227d0dcd75bad5 (patch)
tree70eef9380cdce82cbf943fb5bcc387aaf3d857fe
parentd5759daf643272fed402cfe27a7ebdf487c323bd (diff)
parentf1c92476634485c6a2fb17d33046cedddaa150a2 (diff)
downloadrust-326331c34f70617c3e779c6bf8227d0dcd75bad5.tar.gz
rust-326331c34f70617c3e779c6bf8227d0dcd75bad5.zip
Rollup merge of #51399 - ngg:nll-performance, r=nikomatsakis
NLL performance boost

This makes compilation of the [inflate](https://github.com/rust-lang-nursery/rustc-perf/tree/master/collector/benchmarks/inflate) benchmark compile 2 times faster on my computer when NLL is enabled.
This does not fix the #51377 perfectly, it's still 4-5 times slower than without NLL, but it's a start.
-rw-r--r--src/librustc_mir/borrow_check/nll/type_check/liveness.rs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs
index d19fd2bb596..76320c6a2ea 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs
@@ -104,13 +104,15 @@ impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flo
                     location, live_local
                 );
 
-                self.flow_inits.each_state_bit(|mpi_init| {
-                    debug!(
-                        "add_liveness_constraints: location={:?} initialized={:?}",
-                        location,
-                        &self.flow_inits.operator().move_data().move_paths[mpi_init]
-                    );
-                });
+                if log_enabled!(::log::Level::Debug) {
+                    self.flow_inits.each_state_bit(|mpi_init| {
+                        debug!(
+                            "add_liveness_constraints: location={:?} initialized={:?}",
+                            location,
+                            &self.flow_inits.operator().move_data().move_paths[mpi_init]
+                        );
+                    });
+                }
 
                 let mpi = self.move_data.rev_lookup.find_local(live_local);
                 if let Some(initialized_child) = self.flow_inits.has_any_child_of(mpi) {