mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
perf(language_server): use FxDashMap for diagnostics reports map (#7523)
Same as #7521. Use `FxDashMap` instead of plain `DashMap` for hash map storing diagnostics.
This commit is contained in:
parent
169b8bfa5c
commit
55f3636ecf
1 changed files with 5 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ use globset::Glob;
|
|||
use ignore::gitignore::Gitignore;
|
||||
use log::{debug, error, info};
|
||||
use oxc_linter::{FixKind, LinterBuilder, Oxlintrc};
|
||||
use rustc_hash::FxBuildHasher;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::{Mutex, OnceCell, RwLock, SetError};
|
||||
use tower_lsp::lsp_types::{NumberOrString, Position, Range};
|
||||
|
|
@ -27,11 +28,13 @@ use tower_lsp::{
|
|||
Client, LanguageServer, LspService, Server,
|
||||
};
|
||||
|
||||
type FxDashMap<K, V> = DashMap<K, V, FxBuildHasher>;
|
||||
|
||||
struct Backend {
|
||||
client: Client,
|
||||
root_uri: OnceCell<Option<Url>>,
|
||||
server_linter: RwLock<ServerLinter>,
|
||||
diagnostics_report_map: DashMap<String, Vec<DiagnosticReport>>,
|
||||
diagnostics_report_map: FxDashMap<String, Vec<DiagnosticReport>>,
|
||||
options: Mutex<Options>,
|
||||
gitignore_glob: Mutex<Vec<Gitignore>>,
|
||||
}
|
||||
|
|
@ -561,7 +564,7 @@ async fn main() {
|
|||
let stdout = tokio::io::stdout();
|
||||
|
||||
let server_linter = ServerLinter::new();
|
||||
let diagnostics_report_map = DashMap::new();
|
||||
let diagnostics_report_map = FxDashMap::default();
|
||||
|
||||
let (service, socket) = LspService::build(|client| Backend {
|
||||
client,
|
||||
|
|
|
|||
Loading…
Reference in a new issue