Skip to content

with ast: render_module is quadratic; lib/std/tommyds/check_.w (72 KB) runs for more than 36 minutes #1358

Closed

Description

@ehartford

with ast lib/std/tommyds/check_.w did not finish after 36 minutes of CPU time with the installed compiler (v0.15.2.1-g478b26481). The stage1 built from #1357 behaves the same. The parse succeeds and reports its diagnostics before any rendering starts. The time goes to building the dump text: render_module in dump_ast (src/main.w, around line 3163).

sample of the running process shows 1142 of 1332 samples in str_concat_n_copy (rt_core.w:2180) and 132 in with_str_concat_n_move_first. The output string is grown by repeated concatenation, so the cost is quadratic in the output size.

Found while sweeping the tree for #1346, which used ast as a parse-only check. rt/fiber_core_windows.w is also slow: over 30 s.

Expected: ast time grows linearly with file size, for example by writing the output as it goes or by building it in one buffer.

Activity

  1. ehartford commented on Sep 23, 2026

    @ehartford
    ContributorAuthor

    Seen again 2026-09-23 while sweeping parse verdicts for #1391 (the #1475 report, now closed as a duplicate). stage1 of origin/main ba2d5d1 is killed at 60 s on lib/std/tommyds/check_.w, and check of the same file takes 14 s. With a 5 s per-file timeout, these files also do not finish: lib/std/build.w, lib/std/re/defs.w, rt/fiber_core_darwin.w, rt/fiber_core_windows.w, src/compiler/LlvmBridge.w.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions