Commit a098d73
committed
perf(builtin): Iter::join accepts StringView separator
The other members of the join family — `Array::join`, `ArrayView::join`,
`FixedArray::join`, `ReadOnlyArray::join`, `Deque::join` — already take
`separator : StringView`. `Iter::join` was the outlier, taking `String`,
which forced every StringView caller to do `separator.to_owned()` before
calling it.
This is an *expanding* mbti change: every existing caller keeps working
(String literals and `String` values coerce to `StringView`), and
StringView callers stop needing the owning copy. Internally the
implementation swaps `write_string(sep)` for `write_view(sep)`, which is
zero-copy on non-js StringBuilder.
Supersedes #3458 — `Deque::join`'s body no longer needs to work around
Iter::join's signature.1 parent 55a95d6 commit a098d73
2 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
425 | | - | |
| 425 | + | |
426 | 426 | | |
427 | 427 | | |
428 | 428 | | |
429 | 429 | | |
430 | | - | |
| 430 | + | |
431 | 431 | | |
432 | 432 | | |
433 | 433 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
286 | | - | |
| 286 | + | |
287 | 287 | | |
288 | 288 | | |
289 | 289 | | |
| |||
0 commit comments