Skip to content

Commit 3917d45

Browse files
committed
perf(renderer): pad trailing dashes in place without a temp String
`render_string_groups` padded each row with `row.push_str(&"-".repeat(n))`, which allocates a throwaway String only to copy it into a row buffer that already reserves the full width. Fill in place with `push` instead, matching the dash-padding loop already in `render_fret`. Render output is unchanged (PRD finding F4) and the render snapshot tests pass.
1 parent 81f97be commit 3917d45

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Index `yen()` successors by node group instead of re-scanning the full node list. `calc_next_nodes` now looks up the one contiguous beat group through `path_node_groups` rather than filtering a flattened `Vec<Node>`, which drops the adjacency term from roughly O(k * N^2) toward O(group size) on multi-arrangement and long inputs. Arrangement output is byte-for-byte unchanged.
88
- Dropped the `average` dependency and compute the non-zero-fret mean inline. This removes eight crates from the non-dev dependency graph (`average`, `rayon`, `rayon-core`, the three `crossbeam-*` crates, `easy-cast`, `float-ord`), so Rayon no longer compiles into the production or WASM build. That restores [ADR-0009](docs/adr/0009-pipeline-stays-single-threaded.md)'s no-Rayon state and slightly shrinks the size-optimized WASM artifact. The mean is arithmetically identical, pinned by the existing `calc_avg_non_zero_fret` tests.
99
- Compile the pitch regex once into a process-lifetime `LazyLock<Regex>` static instead of rebuilding it on every cache-missing `parse_lines` call. Behavior is unchanged.
10+
- Pad a rendered row's trailing dashes in place with `push` instead of building and copying a throwaway `"-".repeat(..)` `String`. The row buffer already reserves the full width, so the bytes have a home. Render output is unchanged, pinned by the render snapshot tests.
1011

1112
## 2.0.0 -- 2026-06-05
1213

src/renderer.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,9 @@ fn render_string_groups(
699699
row.push_str(&padding_render);
700700
}
701701
let remaining_characters = (width as usize).saturating_sub(row.len());
702-
row.push_str(&"-".repeat(remaining_characters));
702+
for _ in 0..remaining_characters {
703+
row.push('-');
704+
}
703705

704706
single_string_rows.push(row);
705707
}

0 commit comments

Comments
 (0)