Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-05-14 - [Intermediate Allocations]
**Learning:** String concatenation using `.collect::<Vec<_>>().join("")` creates unnecessary intermediate allocations compared to `.collect::<String>()`.
**Action:** Always prefer `.collect::<String>()` for iterator-based string building.
8 changes: 3 additions & 5 deletions xdk-lib/src/casing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ impl Casing {
result
}
}
Casing::Pascal => words
.iter()
.map(|w| pascal_case(w))
.collect::<Vec<_>>()
.join(""),
// Bolt: optimize string concatenation by directly collecting into a String
// to avoid intermediate Vec allocations.
Casing::Pascal => words.iter().map(|w| pascal_case(w)).collect::<String>(),
Casing::Kebab => words.join("-").to_lowercase(),
Casing::ScreamingSnake => words.join("_").to_uppercase(),
}
Expand Down
Loading