perf: completely eradicate large vector allocations and state locking double-clones in main, meta, env, workspaces, and notes modules

This commit is contained in:
Riz Ashraf committed 2026-09-21 15:22:44 +01:00
1 parent 6b37799cc5
commit 9476bcd649
9 files changed
+352 -125

No files matched your search

+6 -3
View File
@@ -61,9 +61,11 @@ impl McpTool for ReadEnvFingerprintHandler {
async fn execute(&self, args: Value, state: Arc<MemoryState>) -> Result<String, String> {
let req: ReadEnvFingerprintTool =
serde_json::from_value(args).map_err(|e| e.to_string())?;
let fps = state.env_fingerprints.read();
if let Some(fp) = fps.get(&req.namespace) {
let data = serde_json::to_string(fp).unwrap_or_default();
let data = state.env_fingerprints.read_with(|fps| {
fps.get(&req.namespace).cloned()
});
if let Some(fp) = data {
let data = serde_json::to_string(&fp).unwrap_or_default();
Ok(data.to_string())
} else {
Ok("{}".to_string())
@@ -164,3 +166,4 @@ impl McpTool for GetEnvironmentDetailsHandler {
}