From 20dc1b615d39e26a4083967b27823680a5e2e12e Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 7 Jul 2024 08:24:10 +0200 Subject: [PATCH] Drop unused profile things --- src/tools/rust-analyzer/Cargo.lock | 10 ---------- src/tools/rust-analyzer/crates/hir-def/Cargo.toml | 1 - .../rust-analyzer/crates/hir-def/src/item_scope.rs | 4 ---- src/tools/rust-analyzer/crates/ide/src/status.rs | 3 --- src/tools/rust-analyzer/crates/profile/Cargo.toml | 4 ---- src/tools/rust-analyzer/crates/profile/src/lib.rs | 7 ------- .../crates/rust-analyzer/src/cli/analysis_stats.rs | 4 ---- 7 files changed, 33 deletions(-) diff --git a/src/tools/rust-analyzer/Cargo.lock b/src/tools/rust-analyzer/Cargo.lock index f30f69eb6eb3..c63d65954328 100644 --- a/src/tools/rust-analyzer/Cargo.lock +++ b/src/tools/rust-analyzer/Cargo.lock @@ -221,11 +221,6 @@ name = "countme" version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" -dependencies = [ - "dashmap", - "once_cell", - "rustc-hash", -] [[package]] name = "cov-mark" @@ -548,7 +543,6 @@ dependencies = [ "limit", "mbe", "once_cell", - "profile", "ra-ap-rustc_abi", "ra-ap-rustc_parse_format", "rustc-hash", @@ -1400,13 +1394,9 @@ name = "profile" version = "0.0.0" dependencies = [ "cfg-if", - "countme", - "la-arena 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc", - "once_cell", "perf-event", "tikv-jemalloc-ctl", - "tracing", "windows-sys 0.52.0", ] diff --git a/src/tools/rust-analyzer/crates/hir-def/Cargo.toml b/src/tools/rust-analyzer/crates/hir-def/Cargo.toml index 41c59ea0d93f..660799d61087 100644 --- a/src/tools/rust-analyzer/crates/hir-def/Cargo.toml +++ b/src/tools/rust-analyzer/crates/hir-def/Cargo.toml @@ -37,7 +37,6 @@ stdx.workspace = true intern.workspace = true base-db.workspace = true syntax.workspace = true -profile.workspace = true hir-expand.workspace = true mbe.workspace = true cfg.workspace = true diff --git a/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs b/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs index 9c7dfa05b0e4..d86c0667a0bb 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/item_scope.rs @@ -8,7 +8,6 @@ use hir_expand::{attrs::AttrId, db::ExpandDatabase, name::Name, AstId, MacroCall use itertools::Itertools; use la_arena::Idx; use once_cell::sync::Lazy; -use profile::Count; use rustc_hash::{FxHashMap, FxHashSet}; use smallvec::{smallvec, SmallVec}; use stdx::format_to; @@ -65,8 +64,6 @@ pub struct ImportId { #[derive(Debug, Default, PartialEq, Eq)] pub struct ItemScope { - _c: Count, - /// Defs visible in this scope. This includes `declarations`, but also /// imports. The imports belong to this module and can be resolved by using them on /// the `use_imports_*` fields. @@ -722,7 +719,6 @@ impl ItemScope { pub(crate) fn shrink_to_fit(&mut self) { // Exhaustive match to require handling new fields. let Self { - _c: _, types, values, macros, diff --git a/src/tools/rust-analyzer/crates/ide/src/status.rs b/src/tools/rust-analyzer/crates/ide/src/status.rs index 8e7767c8e5d7..69526ddef913 100644 --- a/src/tools/rust-analyzer/crates/ide/src/status.rs +++ b/src/tools/rust-analyzer/crates/ide/src/status.rs @@ -44,9 +44,6 @@ pub(crate) fn status(db: &RootDatabase, file_id: Option) -> String { format_to!(buf, "{}\n", collect_query(LibrarySymbolsQuery.in_db(db))); format_to!(buf, "{}\n", collect_query(ModuleSymbolsQuery.in_db(db))); format_to!(buf, "{} in total\n", memory_usage()); - if env::var("RA_COUNT").is_ok() { - format_to!(buf, "\nCounts:\n{}", profile::countme::get_all()); - } format_to!(buf, "\nDebug info:\n"); format_to!(buf, "{}\n", collect_query(AttrsQuery.in_db(db))); diff --git a/src/tools/rust-analyzer/crates/profile/Cargo.toml b/src/tools/rust-analyzer/crates/profile/Cargo.toml index 11a8e7af56a4..5989dc6c9629 100644 --- a/src/tools/rust-analyzer/crates/profile/Cargo.toml +++ b/src/tools/rust-analyzer/crates/profile/Cargo.toml @@ -12,12 +12,8 @@ rust-version.workspace = true doctest = false [dependencies] -once_cell = "1.17.0" -tracing.workspace = true cfg-if = "1.0.0" -la-arena.workspace = true libc.workspace = true -countme = { version = "3.0.1", features = ["enable"] } jemalloc-ctl = { version = "0.5.0", package = "tikv-jemalloc-ctl", optional = true } [target.'cfg(target_os = "linux")'.dependencies] diff --git a/src/tools/rust-analyzer/crates/profile/src/lib.rs b/src/tools/rust-analyzer/crates/profile/src/lib.rs index c1ae0d43d072..205341f162d4 100644 --- a/src/tools/rust-analyzer/crates/profile/src/lib.rs +++ b/src/tools/rust-analyzer/crates/profile/src/lib.rs @@ -12,13 +12,6 @@ pub use crate::{ stop_watch::{StopWatch, StopWatchSpan}, }; -pub use countme; -/// Include `_c: Count` field in important structs to count them. -/// -/// To view the counts, run with `RA_COUNT=1`. The overhead of disabled count is -/// almost zero. -pub use countme::Count; - thread_local!(static IN_SCOPE: RefCell = const { RefCell::new(false) }); /// A wrapper around google_cpu_profiler. diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs index a934e14ddb38..c9c19806bef8 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/cli/analysis_stats.rs @@ -250,10 +250,6 @@ impl flags::AnalysisStats { } report_metric("total memory", total_span.memory.allocated.megabytes() as u64, "MB"); - if env::var("RA_COUNT").is_ok() { - eprintln!("{}", profile::countme::get_all()); - } - if self.source_stats { let mut total_file_size = Bytes::default(); for e in ide_db::base_db::ParseQuery.in_db(db).entries::>() {