diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-05 14:55:17 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-05 14:55:17 +0100 |
commit | 12a7329cb3141e8b6e719cc08f1eea1bdb3fae3a (patch) | |
tree | 4048f6a71b825dd93d7c968bc44471143d69473b /crates/ra_cli/src/analysis_stats.rs | |
parent | a490f80a9c49380c5088b704047bb20b76c06e4d (diff) | |
parent | f1cfd5ec3de3de39e5423e80a35c719463c4e5c0 (diff) |
Merge #1648
1648: Optimize parsing a little r=lnicola a=lnicola
This is the change from https://github.com/rust-analyzer/rust-analyzer/issues/1643#issuecomment-517979911. In the long run we should probably take a different approach, but until then this provides a decent speed-up (10.5s vs 11.5s according to `ra_cli analysis-stats`.
EDIT: Does the profiling part make sense? I'm not sure if all parsing happens before the type inference begins or it's lazy.
Co-authored-by: Laurențiu Nicola <[email protected]>
Co-authored-by: Laurențiu Nicola <[email protected]>
Diffstat (limited to 'crates/ra_cli/src/analysis_stats.rs')
-rw-r--r-- | crates/ra_cli/src/analysis_stats.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_cli/src/analysis_stats.rs b/crates/ra_cli/src/analysis_stats.rs index 403aab352..7e7e6c073 100644 --- a/crates/ra_cli/src/analysis_stats.rs +++ b/crates/ra_cli/src/analysis_stats.rs | |||
@@ -52,6 +52,9 @@ pub fn run(verbose: bool, memory_usage: bool, path: &Path, only: Option<&str>) - | |||
52 | println!("Total modules found: {}", visited_modules.len()); | 52 | println!("Total modules found: {}", visited_modules.len()); |
53 | println!("Total declarations: {}", num_decls); | 53 | println!("Total declarations: {}", num_decls); |
54 | println!("Total functions: {}", funcs.len()); | 54 | println!("Total functions: {}", funcs.len()); |
55 | println!("Item Collection: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage()); | ||
56 | |||
57 | let inference_time = Instant::now(); | ||
55 | let bar = indicatif::ProgressBar::with_draw_target( | 58 | let bar = indicatif::ProgressBar::with_draw_target( |
56 | funcs.len() as u64, | 59 | funcs.len() as u64, |
57 | indicatif::ProgressDrawTarget::stderr_nohz(), | 60 | indicatif::ProgressDrawTarget::stderr_nohz(), |
@@ -112,7 +115,8 @@ pub fn run(verbose: bool, memory_usage: bool, path: &Path, only: Option<&str>) - | |||
112 | num_exprs_partially_unknown, | 115 | num_exprs_partially_unknown, |
113 | (num_exprs_partially_unknown * 100 / num_exprs) | 116 | (num_exprs_partially_unknown * 100 / num_exprs) |
114 | ); | 117 | ); |
115 | println!("Analysis: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage()); | 118 | println!("Inference: {:?}, {}", inference_time.elapsed(), ra_prof::memory_usage()); |
119 | println!("Total: {:?}, {}", analysis_time.elapsed(), ra_prof::memory_usage()); | ||
116 | 120 | ||
117 | if memory_usage { | 121 | if memory_usage { |
118 | drop(db); | 122 | drop(db); |