perf: 使用 itertools 提供的 join,避免 collect 到 Vec 的额外分配 (#652)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2026-02-19 19:04:10 +08:00
committed by GitHub
parent 5350d3491b
commit bb1576a0df
3 changed files with 5 additions and 16 deletions

View File

@@ -116,10 +116,7 @@ async fn execute_page_update_batch(
txn: &DatabaseTransaction,
pages: impl Iterator<Item = (i32, u32)>,
) -> Result<(), sea_orm::DbErr> {
let values = pages
.map(|p| format!("({}, {})", p.0, p.1))
.collect::<Vec<_>>()
.join(", ");
let values = pages.map(|p| format!("({}, {})", p.0, p.1)).join(", ");
if values.is_empty() {
return Ok(());
}