From e4186ccf2fdd729015900ba718a6ad7b61ea801f Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 8 Sep 2026 08:16:38 +0000 Subject: [PATCH] perf(cli): optimize string concatenation in migrate command Replaced the expensive `format!` allocation with sequential `push_str()` and `push()` operations onto the pre-allocated `result` string buffer in the `replace_call` function. This avoids unnecessary heap allocations during string processing loops. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- cli/src/commands/migrate.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cli/src/commands/migrate.rs b/cli/src/commands/migrate.rs index 8bbd611d..0d2d85c6 100644 --- a/cli/src/commands/migrate.rs +++ b/cli/src/commands/migrate.rs @@ -263,7 +263,9 @@ fn replace_call(source: &str, prefix: &str, keyword: &str) -> String { remaining = &remaining[pos + full.len()..]; if let Some(close) = remaining.find(')') { let args = &remaining[..close]; - result.push_str(&format!("{keyword} {args}")); + result.push_str(keyword); + result.push(' '); + result.push_str(args); remaining = &remaining[close + 1..]; } else { result.push_str(remaining);