Skip to content

Commit

Permalink
Reduce memory usage in language server by not caching AST
Browse files Browse the repository at this point in the history
  • Loading branch information
muglug committed Oct 6, 2023
1 parent 5f7faa3 commit 52fdeb6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/file_scanner_analyzer/scanner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ pub fn scan_files(
!test_patterns.iter().any(|p| p.matches(&str_path)),
&logger,
) {
if analyze_map.contains(&str_path) {
if !config.ast_diff && analyze_map.contains(&str_path) {
asts.lock().unwrap().insert(**file_path, scanner_result.1);
}

Expand Down Expand Up @@ -405,7 +405,7 @@ pub fn scan_files(
!test_patterns.iter().any(|p| p.matches(&str_path)),
&logger.clone(),
) {
if analyze_map.contains(&str_path) {
if !config.ast_diff && analyze_map.contains(&str_path) {
local_asts.insert(*file_path, scanner_result.1);
}

Expand Down Expand Up @@ -490,10 +490,6 @@ pub fn scan_files(
}
}

codebase.classlike_infos.shrink_to_fit();
codebase.functionlike_infos.shrink_to_fit();
codebase.type_definitions.shrink_to_fit();

Ok(ScanFilesResult {
codebase,
interner,
Expand Down

0 comments on commit 52fdeb6

Please sign in to comment.