Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
project: Increase search detect yield threshold to 20KB (#47824)
Xiaobo Liu2c4a823e70f0
diff --git a/crates/project/src/search.rs b/crates/project/src/search.rsindex c83d7b5a560..a64172928fb 100644--- a/crates/project/src/search.rs+++ b/crates/project/src/search.rs@@ -345,16 +345,16 @@ impl SearchQuery {let mut text = String::new();let mut bytes_read = 0;- // Yield from this function every 128 bytes scanned.- const YIELD_THRESHOLD: usize = 128;+ // Yield from this function every 20KB scanned.+ const YIELD_THRESHOLD: usize = 20 * 1024;match self {Self::Text { search, .. } => {if query_str.contains('\n') {reader.read_to_string(&mut text)?;Ok(search.is_match(&text))} else {- // Yield from this function every 128 bytes scanned.- const YIELD_THRESHOLD: usize = 128;+ // Yield from this function every 20KB scanned.+ const YIELD_THRESHOLD: usize = 20 * 1024;while reader.read_line(&mut text)? > 0 {if search.is_match(&text) {return Ok(true);