From 37c7de286adf730cf6f5e15c990915add3d654f1 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 26 Aug 2026 14:08:11 +0000 Subject: [PATCH] perf: optimize URL string formatting in fetch_historical_rates_batch Replaced `format!` with `String::with_capacity` and `push_str` for URL construction inside the `fetch_historical_rates_batch` loop. This avoids parsing overhead and reduces allocations in the hot path. Co-authored-by: Horizontal42 <75383519+Horizontal42@users.noreply.github.com> --- src-tauri/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9a32958..d9fe560 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -631,7 +631,10 @@ async fn fetch_historical_rates_batch( let mut futures = Vec::new(); for date in missing_dates { - let url = format!("https://api.frankfurter.dev/v1/{}?from=USD", date); + let mut url = String::with_capacity(42 + date.len()); + url.push_str("https://api.frankfurter.dev/v1/"); + url.push_str(&date); + url.push_str("?from=USD"); let client_clone = client.clone(); let app_clone = app.clone();