mirror of
https://github.com/Horizontal42/summarum.git
synced 2026-11-11 02:12:00 +03:00
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>
This commit is contained in:
parent
37cfd2144b
commit
37c7de286a
1 changed files with 4 additions and 1 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue