You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The C-package UAT probe programs in build/release_uat.w (ruat_zlib_program, ruat_bzip2_program, ruat_sqlite3_program, ruat_openssl_program, ruat_libcurl_program) are ~200 lines of escaped With source assembled with chained "..." ++ string concatenation. The embedded program is hard to read, hard to review, and invisible to syntax checking until the gate actually runs.
Direction (settled by the mission principles)
Earlier drafts of this issue weighed StringBuilder vs. fixture files. The no-ceremony principle decides it: the escaping/quoting/concatenation is the ceremony, and a StringBuilder rewrite would keep all of it (escaped quotes, one push_str per line) while only reshaping the operator. The ceremony-free representation of a With program is a With source file.
Fix: move each probe program to a fixture file (e.g. build/release_uat_fixtures/<pkg>_main.w), and have ruat_run_c_package_uat read the fixture and write it into the fresh project's src/main.w. The probes become real .w files that editors and with check can see, escaping disappears, and the diff for a probe change is the probe itself.
Notes:
The fixture read happens inside the UAT action, which already has ctx.fs() access and runs from the repo checkout — hermeticity is unchanged.
This issue originally proposed a StringBuilder rewrite on a quadratic-concat claim that turned out to be wrong — see the correction comment. Kept for the audit trail.
Correction to the performance claim in this issue, after reading the actual lowering.
The quadratic-append concern does not apply to these functions. The compiler already flattens left-leaning a ++ b ++ ... ++ z chains in a single expression into one n-ary concat (MirLower.w:2656 → lower_str_concat_chain → RK_STR_CONCAT_N → with_str_concat_n): lengths are summed once, one allocation, one memcpy per part. Each ruat_*_program() builder is exactly such a chain, so it already compiles to a single allocation. Rewriting to StringBuilder would be no faster — per-push calls would likely be marginally slower.
The StringBuilder doc-comment warning applies to repeated reassignment (s = s ++ x in a loop), and even that is handled for non-aliased locals by try_lower_string_self_concat_assign → with_str_concat_n_move_first, which appends in place while the allocator size class has slack (classes double from 16 to 4096 bytes, so small-string accumulation is amortized).
What remains of this issue is readability only. The real performance gap discovered while verifying this is filed as #554 (large-string self-append loops are quadratic past 4KB).
changed the title [-]release_uat.w: UAT probe programs built via str ++ concatenation — use StringBuilder[/-][+]release_uat.w: UAT probe programs as escaped ++ string chains are hard to read[/+]on Jun 11, 2026
changed the title [-]release_uat.w: UAT probe programs as escaped ++ string chains are hard to read[/-][+]release_uat.w: move embedded UAT probe programs to fixture .w files[/+]on Jun 11, 2026
Fixed in 7b39ff0. All six probe programs (zlib, bzip2, sqlite3, openssl, libcurl, raylib spiral) now live as real .w files under build/release_uat_fixtures/; the gates read each fixture and write it into the fresh project. Fixtures are declared as build-graph inputs, so editing a probe re-runs its gate. The decoded fixture content was verified byte-identical to the old builders' output, and the full :release-uat (all 11 gates) passed from fixtures. release_uat.w shrank by ~230 lines of escaped concatenation.
Activity
ehartford commentedon Jun 11, 2026
Correction to the performance claim in this issue, after reading the actual lowering.
The quadratic-append concern does not apply to these functions. The compiler already flattens left-leaning
a ++ b ++ ... ++ zchains in a single expression into one n-ary concat (MirLower.w:2656→lower_str_concat_chain→RK_STR_CONCAT_N→with_str_concat_n): lengths are summed once, one allocation, one memcpy per part. Eachruat_*_program()builder is exactly such a chain, so it already compiles to a single allocation. Rewriting toStringBuilderwould be no faster — per-push calls would likely be marginally slower.The
StringBuilderdoc-comment warning applies to repeated reassignment (s = s ++ xin a loop), and even that is handled for non-aliased locals bytry_lower_string_self_concat_assign→with_str_concat_n_move_first, which appends in place while the allocator size class has slack (classes double from 16 to 4096 bytes, so small-string accumulation is amortized).What remains of this issue is readability only. The real performance gap discovered while verifying this is filed as #554 (large-string self-append loops are quadratic past 4KB).
[-]release_uat.w: UAT probe programs built via str ++ concatenation — use StringBuilder[/-][+]release_uat.w: UAT probe programs as escaped ++ string chains are hard to read[/+][-]release_uat.w: UAT probe programs as escaped ++ string chains are hard to read[/-][+]release_uat.w: move embedded UAT probe programs to fixture .w files[/+]Move release UAT probe programs to fixture files
ehartford commentedon Jun 12, 2026
Fixed in 7b39ff0. All six probe programs (zlib, bzip2, sqlite3, openssl, libcurl, raylib spiral) now live as real
.wfiles underbuild/release_uat_fixtures/; the gates read each fixture and write it into the fresh project. Fixtures are declared as build-graph inputs, so editing a probe re-runs its gate. The decoded fixture content was verified byte-identical to the old builders' output, and the full:release-uat(all 11 gates) passed from fixtures. release_uat.w shrank by ~230 lines of escaped concatenation.