From b678375c69822a9daa4944a60dfdc5fe740aba0b Mon Sep 17 00:00:00 2001 From: pedrocarlo Date: Tue, 4 Feb 2025 15:38:02 -0300 Subject: [PATCH] increasing string capacity to reduce allocations --- core/json/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/json/mod.rs b/core/json/mod.rs index 4d972c150..cdb1d8ed6 100644 --- a/core/json/mod.rs +++ b/core/json/mod.rs @@ -685,7 +685,7 @@ pub fn json_quote(value: &OwnedValue) -> crate::Result { return Ok(value.to_owned()); } - let mut escaped_value = String::with_capacity(t.value.len()); + let mut escaped_value = String::with_capacity(t.value.len() + 4); escaped_value.push('"'); for c in t.value.to_string_lossy().chars() { match c {