mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
cleanup + detect num cpus
This commit is contained in:
parent
0b0bfc6fdd
commit
f83c0166be
6 changed files with 13 additions and 38 deletions
|
@ -31,6 +31,7 @@ serde = { version = "1.0.106", features = ["derive"] }
|
|||
serde_json = { version = "1.0.48", features = ["preserve_order"] }
|
||||
threadpool = "1.7.1"
|
||||
rayon = "1.5"
|
||||
num_cpus = "1.13.1"
|
||||
mimalloc = { version = "0.1.19", default-features = false, optional = true }
|
||||
lsp-server = "0.5.1"
|
||||
tracing = "0.1"
|
||||
|
|
|
@ -88,7 +88,7 @@ pub fn load_workspace(
|
|||
load_crate_graph(crate_graph, project_folders.source_root_config, &mut vfs, &receiver);
|
||||
|
||||
if load_config.prefill_caches {
|
||||
host.analysis().prime_caches(|_| {})?;
|
||||
host.analysis().parallel_prime_caches(1, |_| {})?;
|
||||
}
|
||||
Ok((host, vfs, proc_macro_client))
|
||||
}
|
||||
|
|
|
@ -509,10 +509,13 @@ impl GlobalState {
|
|||
let analysis = self.snapshot().analysis;
|
||||
move |sender| {
|
||||
sender.send(Task::PrimeCaches(PrimeCachesProgress::Begin)).unwrap();
|
||||
let res = analysis.parallel_prime_caches(32, |progress| {
|
||||
let report = PrimeCachesProgress::Report(progress);
|
||||
sender.send(Task::PrimeCaches(report)).unwrap();
|
||||
});
|
||||
let res = analysis.parallel_prime_caches(
|
||||
num_cpus::get_physical().try_into().unwrap_or(u8::MAX),
|
||||
|progress| {
|
||||
let report = PrimeCachesProgress::Report(progress);
|
||||
sender.send(Task::PrimeCaches(report)).unwrap();
|
||||
},
|
||||
);
|
||||
sender
|
||||
.send(Task::PrimeCaches(PrimeCachesProgress::End {
|
||||
cancelled: res.is_err(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue