Skip to content

Commit e7df0ad

Browse files
committed
Remove periodic gc stub
1 parent 7283783 commit e7df0ad

File tree

6 files changed

+13
-64
lines changed

6 files changed

+13
-64
lines changed

crates/ide/src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ impl AnalysisHost {
144144
self.db.apply_change(change)
145145
}
146146

147-
pub fn maybe_collect_garbage(&mut self) {
148-
self.db.maybe_collect_garbage();
149-
}
150-
151147
pub fn collect_garbage(&mut self) {
152148
self.db.collect_garbage();
153149
}

crates/ide/src/status.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,12 @@ pub(crate) fn status(db: &RootDatabase) -> String {
3737
let macro_syntax_tree_stats = macro_syntax_tree_stats(db);
3838
let symbols_stats = LibrarySymbolsQuery.in_db(db).entries::<LibrarySymbolsStats>();
3939
format!(
40-
"{}\n{}\n{}\n{} (macros)\n\n\nmemory:\n{}\ngc {:?} seconds ago",
40+
"{}\n{}\n{}\n{} (macros)\n{} total\n",
4141
files_stats,
4242
symbols_stats,
4343
syntax_tree_stats,
4444
macro_syntax_tree_stats,
4545
memory_usage(),
46-
db.last_gc.elapsed().as_secs(),
4746
)
4847
}
4948

@@ -121,7 +120,7 @@ struct LibrarySymbolsStats {
121120

122121
impl fmt::Display for LibrarySymbolsStats {
123122
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
124-
write!(fmt, "{} ({}) symbols", self.total, self.size)
123+
write!(fmt, "{} ({}) index symbols", self.total, self.size)
125124
}
126125
}
127126

crates/ide_db/src/change.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Defines a unit of change that can applied to a state of IDE to get the next
22
//! state. Changes are transactional.
33
4-
use std::{fmt, sync::Arc, time};
4+
use std::{fmt, sync::Arc};
55

66
use base_db::{
77
salsa::{Database, Durability, SweepStrategy},
@@ -81,8 +81,6 @@ impl fmt::Debug for RootChange {
8181
}
8282
}
8383

84-
const GC_COOLDOWN: time::Duration = time::Duration::from_millis(100);
85-
8684
impl RootDatabase {
8785
pub fn request_cancellation(&mut self) {
8886
let _p = profile::span("RootDatabase::request_cancellation");
@@ -126,23 +124,12 @@ impl RootDatabase {
126124
}
127125
}
128126

129-
pub fn maybe_collect_garbage(&mut self) {
130-
if cfg!(feature = "wasm") {
131-
return;
132-
}
133-
134-
if self.last_gc_check.elapsed() > GC_COOLDOWN {
135-
self.last_gc_check = crate::wasm_shims::Instant::now();
136-
}
137-
}
138-
139127
pub fn collect_garbage(&mut self) {
140128
if cfg!(feature = "wasm") {
141129
return;
142130
}
143131

144132
let _p = profile::span("RootDatabase::collect_garbage");
145-
self.last_gc = crate::wasm_shims::Instant::now();
146133

147134
let sweep = SweepStrategy::default().discard_values().sweep_all_revisions();
148135

crates/ide_db/src/lib.rs

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ pub mod defs;
1010
pub mod search;
1111
pub mod imports_locator;
1212
pub mod source_change;
13-
mod wasm_shims;
1413

1514
use std::{fmt, sync::Arc};
1615

@@ -36,8 +35,6 @@ use crate::{line_index::LineIndex, symbol_index::SymbolsDatabase};
3635
)]
3736
pub struct RootDatabase {
3837
storage: salsa::Storage<RootDatabase>,
39-
pub last_gc: crate::wasm_shims::Instant,
40-
pub last_gc_check: crate::wasm_shims::Instant,
4138
}
4239

4340
impl fmt::Debug for RootDatabase {
@@ -99,11 +96,7 @@ impl Default for RootDatabase {
9996

10097
impl RootDatabase {
10198
pub fn new(lru_capacity: Option<usize>) -> RootDatabase {
102-
let mut db = RootDatabase {
103-
storage: salsa::Storage::default(),
104-
last_gc: crate::wasm_shims::Instant::now(),
105-
last_gc_check: crate::wasm_shims::Instant::now(),
106-
};
99+
let mut db = RootDatabase { storage: salsa::Storage::default() };
107100
db.set_crate_graph_with_durability(Default::default(), Durability::HIGH);
108101
db.set_local_roots_with_durability(Default::default(), Durability::HIGH);
109102
db.set_library_roots_with_durability(Default::default(), Durability::HIGH);
@@ -121,11 +114,7 @@ impl RootDatabase {
121114

122115
impl salsa::ParallelDatabase for RootDatabase {
123116
fn snapshot(&self) -> salsa::Snapshot<RootDatabase> {
124-
salsa::Snapshot::new(RootDatabase {
125-
storage: self.storage.snapshot(),
126-
last_gc: self.last_gc,
127-
last_gc_check: self.last_gc_check,
128-
})
117+
salsa::Snapshot::new(RootDatabase { storage: self.storage.snapshot() })
129118
}
130119
}
131120

crates/ide_db/src/wasm_shims.rs

Lines changed: 0 additions & 19 deletions
This file was deleted.

crates/rust-analyzer/src/main_loop.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,19 +189,16 @@ impl GlobalState {
189189
}
190190
lsp_server::Message::Response(resp) => self.complete_request(resp),
191191
},
192-
Event::Task(task) => {
193-
match task {
194-
Task::Response(response) => self.respond(response),
195-
Task::Diagnostics(diagnostics_per_file) => {
196-
for (file_id, diagnostics) in diagnostics_per_file {
197-
self.diagnostics.set_native_diagnostics(file_id, diagnostics)
198-
}
192+
Event::Task(task) => match task {
193+
Task::Response(response) => self.respond(response),
194+
Task::Diagnostics(diagnostics_per_file) => {
195+
for (file_id, diagnostics) in diagnostics_per_file {
196+
self.diagnostics.set_native_diagnostics(file_id, diagnostics)
199197
}
200-
Task::Workspaces(workspaces) => self.switch_workspaces(workspaces),
201-
Task::Unit => (),
202198
}
203-
self.analysis_host.maybe_collect_garbage();
204-
}
199+
Task::Workspaces(workspaces) => self.switch_workspaces(workspaces),
200+
Task::Unit => (),
201+
},
205202
Event::Vfs(mut task) => {
206203
let _p = profile::span("GlobalState::handle_event/vfs");
207204
loop {

0 commit comments

Comments
 (0)